polars.Series.cat.set_ordering#

Series.cat.set_ordering(ordering: CategoricalOrdering) Series[source]#

Determine how this categorical series should be sorted.

Deprecated since version 0.19.19: Set the ordering directly on the datatype pl.Categorical('lexical') or pl.Categorical('physical') or cast() to the intended data type. This method will be removed in the next breaking change

Parameters:
ordering{‘physical’, ‘lexical’}

Ordering type:

  • ‘physical’ -> Use the physical representation of the categories to determine the order (default).

  • ‘lexical’ -> Use the string values to determine the ordering.