Path: blob/master/04_Apply/US_Crime_Rates/Exercises.ipynb
548 views
Kernel: Python [default]
United States - Crime Rates - 1960 - 2014
Introduction:
This time you will create a data
Special thanks to: https://github.com/justmarkham for sharing the dataset and materials.
Step 1. Import the necessary libraries
In [ ]:
Step 2. Import the dataset from this address.
Step 3. Assign it to a variable called crime.
In [ ]:
Step 4. What is the type of the columns?
In [ ]:
Have you noticed that the type of Year is int64. But pandas has a different type to work with Time Series. Let's see it now.
Step 5. Convert the type of the column Year to datetime64
In [ ]:
Step 6. Set the Year column as the index of the dataframe
In [ ]:
Step 7. Delete the Total column
In [ ]:
Step 8. Group the year by decades and sum the values
Pay attention to the Population column number, summing this column is a mistake
In [ ]:
Step 9. What is the most dangerous decade to live in the US?
In [ ]: