Question: Read the data from yellow_tripdata_small_2016-01.csv Remove any data that is outside the NYC bounding box NYC bounding box: westlimit=-74.2635; southlimit=40.4856; eastlimit=-73.7526; northlimit=40.9596 See http://boundingbox.klokantech.com for

  1. Read the data from "yellow_tripdata_small_2016-01.csv"
  2. Remove any data that is outside the NYC bounding box
    • NYC bounding box: westlimit=-74.2635; southlimit=40.4856; eastlimit=-73.7526; northlimit=40.9596
    • See http://boundingbox.klokantech.com for info on bounding boxes
  3. Calculate taxi trip duration and save in a new column "duration"
  4. Convert duration into a float
  5. Do some basic analysis (see below)
  6. Add a day of week column
  7. Add an hour of day column
  8. Do some analysis (see below)
  9. Divide the data into zones
    • write a function createZoneTable(zone_factor) that divides the bounding box into zones
    • the idea is to create zone_factor * zone_factor zones
    • e.g., if zone_factor is 20, you'll create 20*20 = 400 zones
    • Divide the longitude (-73.7526 to -74.2635) into zone_factor (e.g., 20) sections
    • Divide the latitude (40.4856 to 40.9596) into zone_factor (e.g., 20) sections
    • Return a table (a list of lists) containing a zone id, and the coordinates of the zone
    • (see e.g., below)
  10. Write a function get_zone(lon,lat) that figures out the zone given a latitude and longitude
  11. Apply this function to the dataframe, first with pickup lats and longs; then with dropoff lats and longs
  12. This will give two new "pickup_zone" and "dropoff_zone" columns
  13. Do some analysis (see below)
  14. Using folium, draw a heatmap of the number of trips originating in each zone
    • Create a geojson object for all the zones
    • Create a df that contains zone numbers and the number of trips originating in each zone
    • Use folium to create a heatmap
    • OPTIONAL: You'll notice that the bounding box is much larger than New York City. Try to remove every zone that has 0 originating trips from your map. (Hint: You can remove them from the geojson object)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!