Skip to content

Evaluate whether all boolean values are true for every sub-array

Description

Evaluate whether all boolean values are true for every sub-array

Usage

<Expr>$arr$all()

Value

A polars expression

Examples

library("polars")

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