Skip to content

New Expr referring to all columns

Source code

Description

Not to mix up with Expr_object$all() which is a ‘reduce Boolean columns by AND’ method.

Usage

pl$all(name = NULL)

Arguments

name Character vector indicating on which columns the AND operation should be applied.

Value

Boolean literal

Examples

library("polars")

test = pl$DataFrame(col_1 = c(TRUE, TRUE), col_2 = c(TRUE, FALSE))
test
#> shape: (2, 2)
#> ┌───────┬───────┐
#> │ col_1 ┆ col_2 │
#> │ ---   ┆ ---   │
#> │ bool  ┆ bool  │
#> ╞═══════╪═══════╡
#> │ true  ┆ true  │
#> │ true  ┆ false │
#> └───────┴───────┘
# here, the first `$all()` selects all columns, and the second `$all()` checks
# whether all values are true in each column
test$with_columns(pl$all()$all())
#> shape: (2, 2)
#> ┌───────┬───────┐
#> │ col_1 ┆ col_2 │
#> │ ---   ┆ ---   │
#> │ bool  ┆ bool  │
#> ╞═══════╪═══════╡
#> │ true  ┆ false │
#> │ true  ┆ false │
#> └───────┴───────┘