Sourcing and extracting the data
Back in Chapter 5, you might recall that we used three CSV files, traffic_crashes.csv
, traffic_crash_vehicle.csv
, and traffic_crash_people.csv
, from Chicago’s open data portal. Since these are the same type of files relevant to this tutorial, you can use these same data files for this section.
From your PyCharm environment, initiate your Pipenv environment from the PyCharm terminal and open a new Jupyter notebook.
Within the first cell of the notebook, type import pandas
. Then, write the following code to read in each of the CSV files as individual DataFrames by using the Pandas pd.read_csv()
function:
import pandas as pdtry:      # Read the traffic crashes CSV file and store it in a dataframe      df_crashes = pd.read_csv("data/traffic_crashes.csv")      # Read the traffic crash vehicle CSV file and store it in a dataframe     &...