Question: SHOW CODE USING PYTHON Step 0: Read data and create a dataframe from https://raw.githubusercontent.com/guipsamora/pandas_exercises/master/04_Apply/US_Crime_Rates/US_Crime_Rates_1960_2014.csv Step 1. Set the 'Year' column as the index of the

SHOW CODE USING PYTHON

Step 0: Read data and create a dataframe from

https://raw.githubusercontent.com/guipsamora/pandas_exercises/master/04_Apply/US_Crime_Rates/US_Crime_Rates_1960_2014.csv

Step 1. Set the 'Year' column as the index of the dataframe and then delete the 'Year' and 'Total' columns

Step 2. Which year is the worst (i.e., has the most crimes) in terms of vehicle thefts?

Step 3. Use a lambda function to get the sum of Forcible_Rape, Burglary, and Larceny_Theft and add the results as a new column named 'sub_total'

Step 4. Get the median for 'Aggravated_assault','Murder','Vehicle_Theft'.

Step 5. Get the value counts of round(Aggravated_assault / Robbery * 10).

Step 6. Print the years with the round(Aggravated_assault / Robbery * 10) = 16

Step 7. Select and save the top 10 rows and the following columns: 'Year','sub_total','Population','Burglary'. The output csv file is named "HW8_YourFirstName.csv"

Step 8. Insert a screenshot of the final csv to indicate that it is generated properly.

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!