Skip to main content
Group the events by a column. Use this method to form the grouped data for ranking models.

Parameters

df
DataFrame
required
The dataframe with flat data
group_by_col
str
required
The column to group the data by
output_path
Path | str | None
default:"None"
Optional path to write the grouped data to. If not specified, data won’t be written anywhere

Returns

Dataframe in grouped format

Examples

COLUMN_NAME = 'col_2'

grouped_df = group_by(df=df, group_by_col=COLUMN_NAME)