pandas.api.typing.DataFrameGroupBy.ngroup
pandas 3.1.1 · GroupBy · method
Assign each group a numeric identifier and return it for the corresponding rows.
Call syntax
pd.api.typing.DataFrameGroupBy.ngroup(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