Skip to content

Return indices where condition evaluates to TRUE

Description

Return indices where condition evaluates to TRUE

Usage

pl$arg_where(condition)

Arguments

condition Boolean expression to evaluate.

Value

A polars expression

Examples

library("polars")

df <- pl$DataFrame(a = 1:5)
df$select(
  pl$arg_where(pl$col("a") %% 2 == 0)
)
#> shape: (2, 1)
#> ┌─────┐
#> │ a   │
#> │ --- │
#> │ u32 │
#> ╞═════╡
#> │ 1   │
#> │ 3   │
#> └─────┘