diff --git a/py-polars/polars/dataframe/group_by.py b/py-polars/polars/dataframe/group_by.py index 22b2cb2f818f..42b386fdda7d 100644 --- a/py-polars/polars/dataframe/group_by.py +++ b/py-polars/polars/dataframe/group_by.py @@ -533,7 +533,7 @@ def last(self) -> DataFrame: >>> df = pl.DataFrame( ... { ... "a": [1, 2, 2, 3, 4, 5], - ... "b": [0.5, 0.5, 4, 10, 13, 14], + ... "b": [0.5, 0.5, 4, 10, 14, 13], ... "c": [True, True, True, False, False, True], ... "d": ["Apple", "Orange", "Apple", "Apple", "Banana", "Banana"], ... } @@ -547,7 +547,7 @@ def last(self) -> DataFrame: ╞════════╪═════╪══════╪═══════╡ │ Apple ┆ 3 ┆ 10.0 ┆ false │ │ Orange ┆ 2 ┆ 0.5 ┆ true │ - │ Banana ┆ 5 ┆ 14.0 ┆ true │ + │ Banana ┆ 5 ┆ 13.0 ┆ true │ └────────┴─────┴──────┴───────┘ """ return self.agg(F.all().last()) diff --git a/py-polars/polars/expr/array.py b/py-polars/polars/expr/array.py index 85b21f6c5573..98b8dfe80541 100644 --- a/py-polars/polars/expr/array.py +++ b/py-polars/polars/expr/array.py @@ -512,7 +512,7 @@ def last(self) -> Expr: Examples -------- >>> df = pl.DataFrame( - ... {"a": [[1, 2, 3], [4, 5, 6], [7, 8, 9]]}, + ... {"a": [[1, 2, 3], [4, 5, 6], [7, 9, 8]]}, ... schema={"a": pl.Array(pl.Int32, 3)}, ... ) >>> df.with_columns(last=pl.col("a").arr.last()) @@ -524,7 +524,7 @@ def last(self) -> Expr: ╞═══════════════╪══════╡ │ [1, 2, 3] ┆ 3 │ │ [4, 5, 6] ┆ 6 │ - │ [7, 8, 9] ┆ 9 │ + │ [7, 9, 8] ┆ 8 │ └───────────────┴──────┘ """ diff --git a/py-polars/polars/expr/expr.py b/py-polars/polars/expr/expr.py index ec65f40af0d7..f10db79fb02a 100644 --- a/py-polars/polars/expr/expr.py +++ b/py-polars/polars/expr/expr.py @@ -3355,7 +3355,7 @@ def last(self) -> Expr: Examples -------- - >>> df = pl.DataFrame({"a": [1, 1, 2]}) + >>> df = pl.DataFrame({"a": [1, 3, 2]}) >>> df.select(pl.col("a").last()) shape: (1, 1) ┌─────┐ diff --git a/py-polars/polars/lazyframe/frame.py b/py-polars/polars/lazyframe/frame.py index 2cd4772bda8b..ca8306418135 100644 --- a/py-polars/polars/lazyframe/frame.py +++ b/py-polars/polars/lazyframe/frame.py @@ -4932,7 +4932,7 @@ def last(self) -> LazyFrame: -------- >>> lf = pl.LazyFrame( ... { - ... "a": [1, 3, 5], + ... "a": [1, 5, 3], ... "b": [2, 4, 6], ... } ... ) @@ -4943,7 +4943,7 @@ def last(self) -> LazyFrame: │ --- ┆ --- │ │ i64 ┆ i64 │ ╞═════╪═════╡ - │ 5 ┆ 6 │ + │ 3 ┆ 6 │ └─────┴─────┘ """ return self.tail(1) diff --git a/py-polars/polars/lazyframe/group_by.py b/py-polars/polars/lazyframe/group_by.py index 0a42a1b9a808..8a469e8b1e5d 100644 --- a/py-polars/polars/lazyframe/group_by.py +++ b/py-polars/polars/lazyframe/group_by.py @@ -439,7 +439,7 @@ def last(self) -> LazyFrame: >>> ldf = pl.DataFrame( ... { ... "a": [1, 2, 2, 3, 4, 5], - ... "b": [0.5, 0.5, 4, 10, 13, 14], + ... "b": [0.5, 0.5, 4, 10, 14, 13], ... "c": [True, True, True, False, False, True], ... "d": ["Apple", "Orange", "Apple", "Apple", "Banana", "Banana"], ... } @@ -453,7 +453,7 @@ def last(self) -> LazyFrame: ╞════════╪═════╪══════╪═══════╡ │ Apple ┆ 3 ┆ 10.0 ┆ false │ │ Orange ┆ 2 ┆ 0.5 ┆ true │ - │ Banana ┆ 5 ┆ 14.0 ┆ true │ + │ Banana ┆ 5 ┆ 13.0 ┆ true │ └────────┴─────┴──────┴───────┘ """ return self.agg(F.all().last()) diff --git a/py-polars/polars/series/array.py b/py-polars/polars/series/array.py index c7f70e945bbf..75910ad9446c 100644 --- a/py-polars/polars/series/array.py +++ b/py-polars/polars/series/array.py @@ -403,7 +403,7 @@ def last(self) -> Series: Examples -------- >>> s = pl.Series( - ... "a", [[1, 2, 3], [4, 5, 6], [7, 8, 9]], dtype=pl.Array(pl.Int32, 3) + ... "a", [[1, 2, 3], [4, 5, 6], [7, 9, 8]], dtype=pl.Array(pl.Int32, 3) ... ) >>> s.arr.last() shape: (3,) @@ -411,7 +411,7 @@ def last(self) -> Series: [ 3 6 - 9 + 8 ] """