group_by

pydiverse.transform.group_by(
table: Table,
*cols: Col | ColName | str,
add=False,
) Pipeable[source]

Add a grouping state to the table.

Parameters:
  • cols – The columns to group by.

  • add – If add=True, the given columns are added to the set of columns the table is currently grouped by. If add=False, the current grouping state is replaced by the given columns.

This verb does not modify the table itself, but only adds a grouping in the background. The number of rows is only reduced when summarize is called. The ungroup verb can be used to clear the grouping state.