Skip to content

Commit

Permalink
docs(python): Change ordering of values in example for cum_max (pol…
Browse files Browse the repository at this point in the history
  • Loading branch information
mdavis-xyz authored and Wouittone committed Jun 22, 2024
1 parent a403ba8 commit f06cf29
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions py-polars/polars/expr/expr.py
Original file line number Diff line number Diff line change
Expand Up @@ -1654,22 +1654,22 @@ def cum_min(self, *, reverse: bool = False) -> Self:
Examples
--------
>>> df = pl.DataFrame({"a": [1, 2, 3, 4]})
>>> df = pl.DataFrame({"a": [3, 1, 2]})
>>> 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)
shape: (3, 3)
┌─────┬─────────┬─────────────────┐
│ a ┆ cum_min ┆ cum_min_reverse │
│ --- ┆ --- ┆ --- │
│ i64 ┆ i64 ┆ i64 │
╞═════╪═════════╪═════════════════╡
│ 3 ┆ 3 ┆ 1 │
│ 1 ┆ 1 ┆ 1 │
│ 2 ┆ 1 ┆ 2 │
│ 3 ┆ 1 ┆ 3 │
│ 4 ┆ 1 ┆ 4 │
└─────┴─────────┴─────────────────┘
"""
return self._from_pyexpr(self._pyexpr.cum_min(reverse))

Expand All @@ -1684,23 +1684,23 @@ def cum_max(self, *, reverse: bool = False) -> Self:
Examples
--------
>>> df = pl.DataFrame({"a": [1, 2, 3, 4]})
>>> df = pl.DataFrame({"a": [1, 3, 2]})
>>> df.with_columns(
... pl.col("a").cum_max().alias("cum_max"),
... pl.col("a").cum_max(reverse=True).alias("cum_max_reverse"),
... )
shape: (4, 3)
shape: (3, 3)
┌─────┬─────────┬─────────────────┐
│ a ┆ cum_max ┆ cum_max_reverse │
│ --- ┆ --- ┆ --- │
│ i64 ┆ i64 ┆ i64 │
╞═════╪═════════╪═════════════════╡
│ 1 ┆ 1 ┆ 4 │
│ 2 ┆ 2 ┆ 4 │
│ 3 ┆ 3 ┆ 4 │
│ 4 ┆ 4 ┆ 4 │
│ 1 ┆ 1 ┆ 3 │
│ 3 ┆ 3 ┆ 3 │
│ 2 ┆ 3 ┆ 2 │
└─────┴─────────┴─────────────────┘
Null values are excluded, but can also be filled by calling `forward_fill`.
>>> df = pl.DataFrame({"values": [None, 10, None, 8, 9, None, 16, None]})
Expand Down

0 comments on commit f06cf29

Please sign in to comment.