Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is the second part of the question in this link: (https://www.coursehero.com/qa/wait/35106175/) where Parts 1-7 are needed to be answered: For this question, please answer

This is the second part of the question in this link: (https://www.coursehero.com/qa/wait/35106175/) where Parts 1-7 are needed to be answered:

For this question, please answer parts 8-14.

  1. You should read the data from "yellow_tripdata_small_2016-01.csv". the file link is provided at the end.
  2. You should 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. Please calculate taxi trip duration and save in a new column "duration"
  4. Please convert duration into a float
  5. Please do some basic analysis (see below)
  6. Please add a day of week column
  7. Please add an hour of day column
  8. Please do some analysis (see below)
  9. Please 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. Please write a function get_zone(lon,lat) that figures out the zone given a latitude and longitude
  11. Please 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. Please 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 be able 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)

- The "yellow_tripdata_small_2016-01.csv" file is provided here: https://drive.google.com/file/d/1wxDRPGis5Y2i7DW-prj2pEa3BO4w6A40/view?usp=sharing

- Extra information is provided in the file here: https://drive.google.com/file/d/1mRYbOMiEFyY-BBNRliChXIZ3sPsld_ru/view?usp=sharing

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions