Skip to content

Aggregate the columns in the LazyFrame to their median value

Description

Aggregate the columns in the LazyFrame to their median value

Usage

<LazyFrame>$median()

Value

A polars LazyFrame

Examples

library("polars")

lf <- pl$LazyFrame(a = 1:4, b = c(1, 2, 1, 1))
lf$median()$collect()
#> shape: (1, 2)
#> ┌─────┬─────┐
#> │ a   ┆ b   │
#> │ --- ┆ --- │
#> │ f64 ┆ f64 │
#> ╞═════╪═════╡
#> │ 2.5 ┆ 1.0 │
#> └─────┴─────┘