Skip to content

Return indices that match a condition

Source code

Description

Return indices that match a condition

Usage

pl$arg_where(condition)

Arguments

condition An Expr that gives a boolean.

Value

Expr

Examples

library("polars")

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