Command
df.groupbyExplanation
df.groupby() is used to group data and apply aggregation functions.
Examples
Group by column and calculate mean
df.groupby("col1").mean()Group by multiple columns and sum
df.groupby(["col1", "col2"]).sum()df.groupbydf.groupby() is used to group data and apply aggregation functions.
Group by column and calculate mean
df.groupby("col1").mean()Group by multiple columns and sum
df.groupby(["col1", "col2"]).sum()