polars.Expr.arr.mean#

Expr.arr.mean() Expr[source]#

Compute the mean of the values of the sub-arrays.

Examples

>>> df = pl.DataFrame(
...     data={"a": [[1, 2, 3], [1, 1, 16]]},
...     schema={"a": pl.Array(pl.Int64, 3)},
... )
>>> df.select(pl.col("a").arr.mean())
shape: (2, 1)
┌─────┐
│ a   │
│ --- │
│ f64 │
╞═════╡
│ 2.0 │
│ 6.0 │
└─────┘