polars.Expr.cat.set_ordering#

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

Determine how this categorical series should be sorted.

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.