Comment
07-10-2020
- Mark as New
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report
Thanks @Amelia_Waliany . Your developers can see the the process that I followed with my incredibly messy Python script. If it is helpful, I can provide the contents of the supporting functions. In short, a report segmented by day should be available in the user interface.
def main():
# Get array of date ranges to query the API with.
dateRange = create_date_range_array(startDate, endDate)
# Testing
# print(dateRange)
# Create list to store reports from the API
reportsArray = []
# Loop through date range array and query the API for reports.
for date in dateRange:
# Print currently working report
print('Getting current report for date: %s' % date)
# Make the API request
reportResponse = get_Adobe_abTestResult(adobeTarget_activityId, date, headers)
# Loop through the experiences in the response and add a date column with the appropriate date
for experience in reportResponse:
experience['date'] = date
# Append the report to a list of reports.
reportsArray.append(reportResponse)
# Sleep to avoid hitting API limits.
sleep(1)
# Create dataframe array to store dataframes
reportDataFrameArray = []
# Loop through the reports array and json_normalize them
for report in reportsArray:
tempDataFrame = pd.json_normalize(report)
reportDataFrameArray.append(tempDataFrame)
# Concat all of the dataframes in the dataframe array.
allReportsDataFrame = pd.concat(reportDataFrameArray)
### Testing
# print(reportsArray)
# Convert the dataframe to a csv.
allReportsDataFrame.to_csv(
'Adobe Target - A-B Test Report - Activity ID({0}) - Date(Start-{1}|End-{2}).csv'.format(adobeTarget_activityId,
startDate,
endDate),
index=False)