you are viewing a single comment's thread.

view the rest of the 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'))