polars.cumfold#
- polars.cumfold(
- acc: IntoExpr,
- function: Callable[[Series, Series], Series],
- exprs: Sequence[Expr | str] | Expr,
- *,
- include_init: bool = False,
Cumulatively accumulate over multiple columns horizontally/ row wise with a left fold.
Every cumulative result is added as a separate field in a Struct column.
Deprecated since version 0.19.14: This function has been renamed to
cum_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).
- function
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.
- include_init
Include the initial accumulator state as struct field.