polars.Expr.sort_by

Expr.sort_by(by: Union[polars.internals.expr.Expr, str, List[Union[polars.internals.expr.Expr, str]]], reverse: Union[bool, List[bool]] = False) polars.internals.expr.Expr

Sort this column by the ordering of another column, or multiple other columns. In projection/ selection context the whole column is sorted. If used in a groupby context, the groups are sorted.

Parameters
by

The column(s) used for sorting.

reverse

False -> order from small to large. True -> order from large to small.