Spec-Zone.ru › Polars

polars.Expr.min_by

Expr.min_by(
    by: IntoExpr,
) → Expr

Get minimum value, ordered by another expression.

If the by expression has multiple values equal to the minimum it is not defined which value will be chosen.

engine:In MemoryStreaming

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 smallest element. Accepts expression input. Strings are parsed as column names.

Examples

>>> df = pl.DataFrame({"a": [-1.0, float("nan"), 1.0], "b": ["x", "y", "z"]})
>>> df.select(pl.col("b").min_by("a"))
shape: (1, 1)
┌─────┐
│ b   │
│ --- │
│ str │
╞═════╡
│ x   │
└─────┘

© 2020 Ritchie Vink
© 2022 Polars contributors
Licensed under the MIT License.
https://docs.pola.rs/api/python/stable/reference/expressions/api/polars.Expr.min_by.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API