Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved docstrings of GroupBy op to reinforce the required usage of dataset.shuffle_by_keys() #1551

Merged
merged 4 commits into from
May 20, 2022
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion nvtabular/ops/groupby.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,13 @@ class Groupby(Operator):

Example usage::

groupby_cols = ['user_id', 'session_id']
dataset = dataset.shuffle_by_keys(keys=groupby_cols)

groupby_features = [
'user_id', 'session_id', 'month', 'prod_id',
] >> ops.Groupby(
groupby_cols=['user_id', 'session_id'],
groupby_cols=groupby_cols,
sort_cols=['month'],
aggs={
'prod_id': 'list',
Expand All @@ -46,10 +49,15 @@ class Groupby(Operator):
)
processor = nvtabular.Workflow(groupby_features)

workflow.fit(dataset)
dataset_transformed = workflow.transform(dataset)

Parameters
-----------
groupby_cols : str or list of str
The column names to be used as groupby keys.
WARNING: Ensure the dataset was partitioned by those
groupby keys (see above an example).
karlhigley marked this conversation as resolved.
Show resolved Hide resolved
sort_cols : str or list of str
Columns to be used to sort each partition before
groupby aggregation is performed. If this argument
Expand Down