groupby

groupby() splits a DataFrame into groups according to the values of one or more columns, then applies an aggregation or transformation to each group. This is the "split-apply-combine" pattern, equivalent to SQL's GROUP BY. By default, the result has the group keys as its index.

Example

df.groupby('pays')['ca'].sum()

Related concepts

The whole glossary