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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started