pandas.api.typing.SeriesGroupBy.cumcount
pandas 3.1.1 · GroupBy · method
Number observations in encounter order inside each group, starting at zero.
Call syntax
pd.api.typing.SeriesGroupBy.cumcount(ascending=True)Run the example
Edit the example and select Run Python to see the result.
Parameters
| Parameter | Requirement | Accepted values and behavior |
|---|---|---|
ascending |
Optional Positional or keyword Default True |
bool Choose ascending or descending order. Some sorting methods take one flag per sort key. |
Returns
Series