pandas.core.categorical.Categorical.order¶
- Categorical.order(inplace=False, ascending=True, na_position='last', **kwargs)¶
Sorts the Category by category value returning a new Categorical by default.
Only ordered Categoricals can be sorted!
Categorical.sort is the equivalent but sorts the Categorical inplace.
Parameters : ascending : boolean, default True
Sort ascending. Passing False sorts descending
inplace : boolean, default False
Do operation in place.
na_position : {‘first’, ‘last’} (optional, default=’last’)
‘first’ puts NaNs at the beginning ‘last’ puts NaNs at the end
Returns : y : Category or None
See also
Category.sort