polars.fold

polars.fold(acc: polars.internals.expr.Expr, f: Callable[[polars.internals.series.Series, polars.internals.series.Series], polars.internals.series.Series], exprs: Union[Sequence[Union[polars.internals.expr.Expr, str]], polars.internals.expr.Expr]) polars.internals.expr.Expr

Accumulate over multiple columns horizontally/ row wise with a left fold.

Parameters
acc

Accumulator Expression. This is the value that will be initialized when the fold starts. For a sum this could for instance be lit(0).

f

Function to apply over the accumulator and the value. Fn(acc, value) -> new_value

exprs

Expressions to aggregate over. May also be a wildcard expression.