polars.arg_where#

polars.arg_where(condition: polars.internals.expr.expr.Expr | polars.internals.series.series.Series, eager: Literal[False] = False) Expr[source]#
polars.arg_where(condition: polars.internals.expr.expr.Expr | polars.internals.series.series.Series, eager: Literal[True]) Series
polars.arg_where(condition: polars.internals.expr.expr.Expr | polars.internals.series.series.Series, eager: bool) polars.internals.expr.expr.Expr | polars.internals.series.series.Series

Return indices where condition evaluates True.

Parameters:
condition

Boolean expression to evaluate

eager

Whether to apply this function eagerly (as opposed to lazily).

Examples

>>> df = pl.DataFrame({"a": [1, 2, 3, 4, 5]})
>>> df.select(
...     [
...         pl.arg_where(pl.col("a") % 2 == 0),
...     ]
... ).to_series()
shape: (2,)
Series: 'a' [u32]
[
    1
    3
]