Skip to content

Evaluate whether any boolean values in an array are true

Source code

Description

Evaluate whether any boolean values in an array are true

Usage

<Expr>$arr$any()

Value

Expr

Examples

library("polars")

df = pl$DataFrame(
  values = list(c(TRUE, TRUE), c(FALSE, TRUE), c(FALSE, FALSE), c(NA, NA)),
  schema = list(values = pl$Array(pl$Boolean, 2))
)
df$with_columns(any = pl$col("values")$arr$any())
#> shape: (4, 2)
#> ┌────────────────┬───────┐
#> │ values         ┆ any   │
#> │ ---            ┆ ---   │
#> │ array[bool, 2] ┆ bool  │
#> ╞════════════════╪═══════╡
#> │ [true, true]   ┆ true  │
#> │ [false, true]  ┆ true  │
#> │ [false, false] ┆ false │
#> │ [null, null]   ┆ false │
#> └────────────────┴───────┘