polars.tail#
- polars.tail(column: str, n: int = 10) Expr [source]#
- polars.tail(column: Series, n: int = 10) Series
Get the last n rows.
- Parameters:
- column
Column name or Series.
- n
Number of rows to return.
Examples
>>> df = pl.DataFrame({"a": [1, 8, 3], "b": [4, 5, 2], "c": ["foo", "bar", "foo"]}) >>> df.select(pl.tail("a")) shape: (3, 1) ┌─────┐ │ a │ │ --- │ │ i64 │ ╞═════╡ │ 1 │ │ 8 │ │ 3 │ └─────┘ >>> df.select(pl.tail("a", 2)) shape: (2, 1) ┌─────┐ │ a │ │ --- │ │ i64 │ ╞═════╡ │ 8 │ │ 3 │ └─────┘