pandas.core.groupby.GroupBy.cumcount

Number each item in each group from 0 to the length of that group - 1.

Essentially this is equivalent to

>>> self.apply(lambda x: pd.Series(np.arange(len(x)), x.index))
param ascending
bool, default True

If False, number in reverse, from length of group - 1 to 0.

return

Series Sequence number of each element within each group.

Warning

This feature is currently unsupported by Intel Scalable Dataframe Compiler