NVIDIA / NVIDIA/cudf

[FEA] Add ascending parameter to cumcount.

Open
#12,265 0 comments 0 reactions 0 assignees View on GitHub
0 - Backlog feature request Python
Dominant language
C++
Stars
9.8k
Forks
1.1k
Avg merge
3d 6m
Merged PRs (30d)
278

Description

**Is your feature request related to a problem? Please describe.**
cumcount misses `ascending` parameter present in pandas breaking any code exported from pandas.

**Describe the solution you'd like**
Add `ascending=[True/False]` parameter to cumcount to match pandas syntax.

**Describe alternatives you've considered**
An alternative for `ascending=False` would be to pick the max of the group and subtract from cumcount like:
df['cumcount'] = df.groupby('group')['var'].transform('max') - df.groupby('group')['var'].cumcount()

**Additional context**
https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.core.groupby.GroupBy.cumcount.html
https://docs.rapids.ai/api/cudf/stable/api_docs/api/cudf.core.groupby.groupby.GroupBy.cumcount.html

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.