Solution 6.1
In this activity, you will read in some US population data for large cities for the years 2010 and 2019 and perform some analysis:
- For this activity, all you will need is the
pandas
library. Load it in the first cell of the notebook:import pandas as pd
- Read a
pandas
Series from theUS_Census_SUB-IP-EST2019-ANNRNK_top_20_2010.csv
file. The city names are in the first column; read them in such that they are used as the index. List out the resulting Series:populations_2010 = \ pd.read_csv('..//Datasets//US_Census_SUB-IP-EST2019-ANNRNK_top_20_2010.csv', index_col = [0], squeeze = True) populations_2010
The result should be as follows:
Note that in addition to specifying index_col = [1]
, we use squeeze = True
to store the result in a...