GroupBy Aggregation in Python

From the Pandas cheat sheet ยท Group and Aggregate ยท verified Aug 2026

GroupBy Aggregation

Calculate one or more summaries per group.

python
summary = df.groupby("team")["score"].mean()
๐Ÿ“Œ GroupBy follows split, apply, combine
๐Ÿ’ก Named aggregation creates clear columns
๐Ÿ” as_index=False keeps group keys as columns
โšก Prefer built-in aggregations over lambdas
groupbyaggregationsummary

Continue with Pandas

Save the full cheat sheet or work through every related task.

More Python tasks

Back to the full Pandas cheat sheet