Combine daily requests for February
It's been a month since Sam last ran the report script, and it's time for her to make a new report for February.
She wants to upload new reports for February and update the file listing, expanding on the work she completed during the last video lesson:
She has already created the boto3
S3 client and stored in the s3
variable. She stored the contents of her objects in request_files
.
You will help Sam aggregate the requests from February by downloading files from the gid-requests
bucket and concatenating them into one DataFrame!
This exercise is part of the course
Introduction to AWS Boto in Python
Exercise instructions
- Load each object from
s3
. - Read it into
pandas
and append it todf_list
. - Concatenate all DataFrames in
df_list
. - Preview the DataFrame.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
df_list = []
# Load each object from s3
for file in request_files:
s3_day_reqs = s3.____(Bucket='gid-requests',
Key=file['Key'])
# Read the DataFrame into pandas, append it to the list
day_reqs = pd.read_csv(s3_day_reqs['____'])
df_list.append(day_reqs)
# Concatenate all the DataFrames in the list
all_reqs = pd.____(df_list)
# Preview the DataFrame
all_reqs.head()