Question: I need help with doing step 3 part 2...I am not sure how to tackle the problem. Thank you! Download Pittsburgh Healthy Ride datasets from

I need help with doing step 3 part 2...I am not sure how to tackle the problem. Thank you!

  1. Download Pittsburgh Healthy Ride datasets from https://drive.google.com/file/d/1NH5ZEjWF-XAIuOw52ge0aCX10534ipk-/view?usp=sharing

  2. Unzip the files and make sure that the list of subfolders is in the same folder as your Python script

    1. You should see the following list of subfolders:

      1. 2015-Q2

      2. 2015-Q3

      3. 2015-Q4

      4. 2016-Q1

      5. 2016-Q2

      6. 2016-Q3

      7. 2016-Q4

    2. Each subfolder contains two comma-separated values (.csv) files:

      1. HealthyRide Rentals [year] [quarter] (ex: HealthyRide Rentals 2015 Q2)

      2. HealthyRideStations[year] (ex: HealthyRideStations2015)

    3. Each HealthyRide Rentals [year] [quarter] file contains the following fields (columns): Tripid, Starttime, Stoptime, Bikeid, Tripduration, From station id, From station name, To station id, To station name, Usertype

    4. Each HealthyRideStations[year] file contains the following fields: StationNum, StationName, RackQnty, Latitude, Longitude

    5. Note that From station id and To station id map to StationNum - you will need to join the two datasets on those identifiers

  3. Steps to complete the program

    1. Create two Pandas dataframes - one to store ride data and another to store station data

    2. For loop to iterate through subfolders and files

      1. Append each row from HealthyRide Rentals [year] [quarter] to the dataframe of ride data. An easy way to do this would be to create a temporary dataframe inside the loop, read in the data, and append the temporary dataframe to the master dataframe. Hint: you will need to use the .concat() or .append() function: https://pandas.pydata.org/pandas-docs/stable/merging.html

      2. For the HealthyRideStations[year] file append only unique rows. In other words, you need to make sure that the dataset that contains stations data does not have duplicates.

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 Databases Questions!