polars.Expr.count#

Expr.count() Self[source]#

Count the number of values in this expression.

Warning

null is deemed a value in this context.

Examples

>>> df = pl.DataFrame({"a": [8, 9, 10], "b": [None, 4, 4]})
>>> df.select(pl.all().count())  # counts nulls
shape: (1, 2)
┌─────┬─────┐
│ a   ┆ b   │
│ --- ┆ --- │
│ u32 ┆ u32 │
╞═════╪═════╡
│ 3   ┆ 3   │
└─────┴─────┘