polars.Expr.cum_min#

Expr.cum_min(*, reverse: bool = False) Self[source]#

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

Parameters:
reverse

Reverse the operation.

Examples

>>> df = pl.DataFrame({"a": [1, 2, 3, 4]})
>>> df.with_columns(
...     pl.col("a").cum_min().alias("cum_min"),
...     pl.col("a").cum_min(reverse=True).alias("cum_min_reverse"),
... )
shape: (4, 3)
┌─────┬─────────┬─────────────────┐
│ a   ┆ cum_min ┆ cum_min_reverse │
│ --- ┆ ---     ┆ ---             │
│ i64 ┆ i64     ┆ i64             │
╞═════╪═════════╪═════════════════╡
│ 1   ┆ 1       ┆ 1               │
│ 2   ┆ 1       ┆ 2               │
│ 3   ┆ 1       ┆ 3               │
│ 4   ┆ 1       ┆ 4               │
└─────┴─────────┴─────────────────┘