Lab 8#
We’ll be doing calculations on 2021 Yellow Taxi Trips data using only the Python standard library (not pandas).
Step 0#
The data needs to available on the machine where Python is running in order to process it, so let’s download from the NYC Open Data site directly:
Open https://data.cityofnewyork.us/resource/m6nq-qud6.csv in your browser, which should download the first thousand rows.
We’ll talk about getting more data when we get to APIs.
Move the CSV to the same directory as this notebook.
Rename the CSV something meaningful.
Confirm you can see the file in the JupyterLab File Browser. You may need to tell it to refresh (🔄 button).
Step 1#
Print out the trip distances.
# your code here
Step 2#
Calculate the average ride distance.
# your code here
Step 3#
Your turn! Calculate the percent of trips that were paid for by credit card. The data dictionary will be helpful - see the Attachment on the dataset page.
# your code here
Step 4 (optional)#
Save a random sample of the trips to a new CSV.
# your code here