Dataframe
 
0.15

groupBy

Edit page Last modified: 14 January 2025

Splits the rows of DataFrame into groups using one or several columns as grouping keys.

See column selectors, groupBy transformations, groupBy aggregations, pivot+groupBy

df.groupBy { name }
df.groupBy { city and name.lastName }
df.groupBy { age / 10 named "ageDecade" }

Grouping columns can be created inplace:

df.groupBy { expr { name.firstName.length + name.lastName.length } named "nameLength" }

With optional moveToTop parameter you can choose whether to make a selected nested column a top-level column:

or to keep it inside a ColumnGroup:

Returns GroupBy object.