polars.Expr.list.all#

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

Evaluate whether all boolean values in a list are true.

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(
...     {"a": [[True, True], [False, True], [False, False], [None], [], None]}
... )
>>> df.with_columns(all=pl.col("a").list.all())
shape: (6, 2)
┌────────────────┬───────┐
│ a              ┆ all   │
│ ---            ┆ ---   │
│ list[bool]     ┆ bool  │
╞════════════════╪═══════╡
│ [true, true]   ┆ true  │
│ [false, true]  ┆ false │
│ [false, false] ┆ false │
│ [null]         ┆ true  │
│ []             ┆ true  │
│ null           ┆ null  │
└────────────────┴───────┘