polars.Expr.arr.all#

Expr.arr.all(*, ignore_nulls: bool = True) Expr[source]#

Evaluate whether all boolean values are true for every subarray.

Parameters:
ignore_nulls
  • If set to True (default), null values are ignored. If there are no non-null values, the output is True.

  • If set to False, Kleene logic is used to deal with nulls: if the column contains any null values and no False values, the output is null.

Examples

>>> df = pl.DataFrame(
...     data={
...         "a": [
...             [True, True],
...             [False, True],
...             [False, False],
...             [None, None],
...             None,
...         ]
...     },
...     schema={"a": pl.Array(pl.Boolean, 2)},
... )
>>> df.with_columns(all=pl.col("a").arr.all())
shape: (5, 2)
┌────────────────┬───────┐
│ a              ┆ all   │
│ ---            ┆ ---   │
│ array[bool, 2] ┆ bool  │
╞════════════════╪═══════╡
│ [true, true]   ┆ true  │
│ [false, true]  ┆ false │
│ [false, false] ┆ false │
│ [null, null]   ┆ true  │
│ null           ┆ null  │
└────────────────┴───────┘