Update index to include February
In the previous two exercises, Sam has:
- Read the daily Get It Done request logs for February.
- Combined them into a single DataFrame.
- Generated a DataFrame with aggregated metrics (request counts by type)
- Wrote that DataFrame to a CSV and HTML final report files.
- Uploaded these files to S3.
Now, she wants these files to be accessible through the directory listing. Currently, it only shows links for January reports:
She has created the boto3
S3 client and stored it in the s3
variable.
Help Sam generate a new directory listing with the February's uploaded reports and store it in a DataFrame.
This exercise is part of the course
Introduction to AWS Boto in Python
Exercise instructions
- List the
'gid-reports'
bucket objects starting with'2019/'
. - Convert the content of the objects list to a DataFrame.
- Create a column
'Link'
that contains Public Object URL + key. - Preview the DataFrame.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# List the gid-reports bucket objects starting with 2019/
objects_list = s3.____(Bucket='gid-reports', ____='2019/')
# Convert the response contents to DataFrame
objects_df = pd.____(objects_list['Contents'])
# Create a column "Link" that contains Public Object URL
base_url = "http://gid-reports.s3.amazonaws.com/"
objects_df['Link'] = base_url + objects_df['____']
# Preview the resulting DataFrame
objects_df.head()