pandas.core.categorical.Categorical.sort¶
- Categorical.sort(inplace=True, ascending=True, na_position='last', **kwargs)¶
Sorts the Category inplace by category value.
Only ordered Categoricals can be sorted!
Catgorical.order is the equivalent but returns a new Categorical.
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.order