Method: Polars::Expr#sum

Defined in:
lib/polars/expr.rb

#sumExpr

Note:

Dtypes in \{Int8, UInt8, Int16, UInt16} are cast to Int64 before summing to prevent overflow issues.

Get sum value.

Examples:

df = Polars::DataFrame.new({"a" => [-1, 0, 1]})
df.select(Polars.col("a").sum)
# =>
# shape: (1, 1)
# ┌─────┐
# │ a   │
# │ --- │
# │ i64 │
# ╞═════╡
# │ 0   │
# └─────┘

Returns:



2349
2350
2351
# File 'lib/polars/expr.rb', line 2349

def sum
  wrap_expr(_rbexpr.sum)
end