- polars.fold(acc: IntoExpr, f: Callable[[Series, Series], Series], exprs: Sequence[Expr | str] | Expr) Expr #
Accumulate over multiple columns horizontally/ row wise with a left fold.
Accumulator Expression. This is the value that will be initialized when the fold starts. For a sum this could for instance be lit(0).
Function to apply over the accumulator and the value. Fn(acc, value) -> new_value
Expressions to aggregate over. May also be a wildcard expression.
If you simply want the first encountered expression as accumulator, consider using