Skip to content

Evaluate whether any boolean value in a sub-list is true

Description

Evaluate whether any boolean value in a sub-list is true

Usage

<Expr>$list$any()

Value

A polars expression

Examples

library("polars")

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