I have this data set and I want to display the columns ('Police District Name', 'Number of Crimes') for all crimes with more than 3 victims. However, the column 'Number of Crimes' does not exists and show be created, and it indicates (and the total number of crimes committed in that district). Note: every row indicates 1 crime.
Sample of the data set:
Incident ID Victims Police District Name Beat
0 201087096 1 GERMANTOWN 5N1
1 201087097 1 WHEATON 4K2
2 201087097 1 WHEATON 4K2
3 201087097 1 WHEATON 4K2
4 201087100 1 GERMANTOWN 5M1
Here is my code:
import pandas as pd
crimes_df = pd.read_csv('data/Crime.csv', low_memory=False, dtype={'Incident ID': int, 'Beat':object})
more_than_three_victims = crimes_df[(crimes_df['Victims'] > 3)]
more_than_three_victims.groupby(['Police District Name']).sum()
I have no idea what to do from here, I would appreciate any help.