polars.tail#
- polars.tail(column: str, n: int = 10) Expr [source]#
Get the last
n
rows.This function is syntactic sugar for
pl.col(column).tail(n)
.- Parameters:
- column
Column name.
- 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 │ └─────┘