SigmaAnalytics & Tech
C8PythonIntermediateAbout 120 min to complete

GroupBy & Aggregation

Split-apply-combine — the single most powerful idea in pandas.

Notebook

About 120 minutes to complete

Enrol to read the notebook and download it to run.

What this module covers

Split-apply-combine — the single most powerful idea in pandas.

By the end of it

  • Explain split-apply-combine and what groupby returns before aggregation
  • Aggregate with single functions, multiple functions, and named outputs
  • Group by multiple keys and navigate the resulting MultiIndex
  • Use transform to broadcast group statistics back to every row
  • Use filter to keep or drop entire groups by a condition
  • Apply custom functions with agg and apply, and know the difference
  • Compute window functions: rolling, expanding, and grouped cumulative operations
  • Avoid the common performance and correctness traps