polars.Expr.arr.sum#

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

Compute the sum values of the sub-arrays.

Examples

>>> df = pl.DataFrame(
...     data={"a": [[1, 2], [4, 3]]},
...     schema={"a": pl.Array(inner=pl.Int64, width=2)},
... )
>>> df.select(pl.col("a").arr.sum())
shape: (2, 1)
┌─────┐
│ a   │
│ --- │
│ i64 │
╞═════╡
│ 3   │
│ 7   │
└─────┘