polars.Series.max_by#
- Series.max_by(by: IntoExpr) Expr[source]#
Get the maximum value in this Series, ordered by an expression.
Warning
This functionality is considered unstable. It may be changed at any point without it being considered a breaking change.
- Parameters:
- by
Column used to determine the largest element. Accepts expression input. Strings are parsed as column names.
Examples
>>> s = pl.Series("a", [-2.0, float("nan"), 1.0]) >>> s.max_by(pl.col.a.abs()) -2.0