polars.Expr.arr.sum#

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

Sum all the lists in the array.

Examples

>>> df = pl.DataFrame({"values": [[1], [2, 3]]})
>>> df.select(pl.col("values").arr.sum())
shape: (2, 1)
┌────────┐
│ values │
│ ---    │
│ i64    │
╞════════╡
│ 1      │
├╌╌╌╌╌╌╌╌┤
│ 5      │
└────────┘