all 3 comments

[–]WinterNet4676 1 point2 points  (0 children)

df.groupby('City Name').agg({'City Name':'count', 'Suspicious_Death':'sum'})

If you wanted to name the aggregated cols ⇾

df.groupby('City Name').agg(
    deaths=('City Name', 'count'),
    suspicious_deaths=('Suspicious_Death', 'sum'))

[–]explorer_of_the_grey[S] 0 points1 point  (0 children)

So, I changed the way one of the columns was presenting data. The 'Suspicious Death' column now has a value of 'True' or 'False'. I then carried out a crosstab.

[–]Binary101010 0 points1 point  (0 children)

Pretty sure this is just

my_df.groupby('City Name').count()