Skip to content

Instantly share code, notes, and snippets.

@do-me
Created November 8, 2023 10:07
Show Gist options
  • Select an option

  • Save do-me/07f78e9812df3c3bfdd6b0731966c05f to your computer and use it in GitHub Desktop.

Select an option

Save do-me/07f78e9812df3c3bfdd6b0731966c05f to your computer and use it in GitHub Desktop.
Simple pandas groupby with sum
import pandas as pd
df = pd.read_csv("your_file.csv")
df = df.groupby(["all","columns","you","need_for_grouping"])['value_for_sum'].sum().reset_index()
df
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment