polars.Series.cum_count#

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

Return the cumulative count of the non-null values in the column.

Parameters:
reverse

Reverse the operation.

Examples

>>> s = pl.Series(["x", "k", None, "d"])
>>> s.cum_count()
shape: (4,)
Series: '' [u32]
[
        1
        2
        2
        3
]