Skip to content

Get the last value

Source code

Description

Get the last value

Usage

<Expr>$last()

Value

Expr

Examples

library("polars")

pl$DataFrame(x = 3:1)$with_columns(last = pl$col("x")$last())
#> shape: (3, 2)
#> ┌─────┬──────┐
#> │ x   ┆ last │
#> │ --- ┆ ---  │
#> │ i32 ┆ i32  │
#> ╞═════╪══════╡
#> │ 3   ┆ 1    │
#> │ 2   ┆ 1    │
#> │ 1   ┆ 1    │
#> └─────┴──────┘