Group by involves splitting data, applying functions, and combining results. The split step creates groups based on criteria, while the apply step performs aggregation (e.g., sums, means, counts), transformation (e.g., standardization, filling NAs), or filtration. Built-in GroupBy operations are more efficient than the apply method with user-defined Python functions. For complex or combined operations not fitting standard categories, GroupBy’s apply method examines results to sensibly combine them. GroupBy objects support mapping labels to group names via Python functions, lists, NumPy arrays, or dicts. Operations resemble those in the aggregating API, window API, and resample API. pandas aims to make SQL-like grouping natural. For advanced strategies, consult the cookbook. Scope: pandas. Reviewed October 4, 2026.
Group by: split-apply-combine
Document v1 · published by Koskamo editorial · updated 2026-10-04
Source and provenance
- Original source
- pandas.pydata.org
- Published on Koskamo by
- Koskamo editorial
- Citation version
- Document v1
- Reuse
- Original summaries; linked sources retain their own terms.