Skip to content
masterclass Buddy

Pandas · Function

groupby

Groups DataFrame rows by one or more keys. The returned groupby object supports calculations such as mean() and sum() for each group.

Last updated

Since
3.0.0 for the observed default changing to True

Syntax

DataFrame.groupby(by=None, level=None, *, as_index=True, sort=True, group_keys=True, observed=True, dropna=True)

In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.

Subscribe
  • resample

Source: pandas.DataFrame.groupby — pandas 3.1.0 documentation. Checked 2026-11-03.