Skip to content

Get median value

Source code

Description

Get median value

Usage

<Expr>$median()

Value

Expr

Examples

library("polars")

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