From f06cf29679dcce411e331f1cb1c2925fe945a96c Mon Sep 17 00:00:00 2001 From: Matthew Davis <7035647+mdavis-xyz@users.noreply.github.com> Date: Fri, 24 May 2024 00:16:34 +0200 Subject: [PATCH] docs(python): Change ordering of values in example for `cum_max` (#16456) --- py-polars/polars/expr/expr.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/py-polars/polars/expr/expr.py b/py-polars/polars/expr/expr.py index 712d804600be8..df6730c85914c 100644 --- a/py-polars/polars/expr/expr.py +++ b/py-polars/polars/expr/expr.py @@ -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)) @@ -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]})