polars.Series.cum_prod#

Series.cum_prod(*, reverse: bool = False) Series[source]#

Get an array with the cumulative product computed at every element.

Parameters:
reverse

reverse the operation.

Notes

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

Examples

>>> s = pl.Series("a", [1, 2, 3])
>>> s.cum_prod()
shape: (3,)
Series: 'a' [i64]
[
    1
    2
    6
]