Skip to content

Median

Source code

Description

Aggregate the columns in the LazyFrame to their median value.

Usage

<LazyFrame>$median()

Value

A LazyFrame with one row

Examples

library(polars)

pl$LazyFrame(mtcars)$median()$collect()
#> shape: (1, 11)
#> ┌──────┬─────┬───────┬───────┬───┬─────┬─────┬──────┬──────┐
#> │ mpg  ┆ cyl ┆ disp  ┆ hp    ┆ … ┆ vs  ┆ am  ┆ gear ┆ carb │
#> │ ---  ┆ --- ┆ ---   ┆ ---   ┆   ┆ --- ┆ --- ┆ ---  ┆ ---  │
#> │ f64  ┆ f64 ┆ f64   ┆ f64   ┆   ┆ f64 ┆ f64 ┆ f64  ┆ f64  │
#> ╞══════╪═════╪═══════╪═══════╪═══╪═════╪═════╪══════╪══════╡
#> │ 19.2 ┆ 6.0 ┆ 196.3 ┆ 123.0 ┆ … ┆ 0.0 ┆ 0.0 ┆ 4.0  ┆ 2.0  │
#> └──────┴─────┴───────┴───────┴───┴─────┴─────┴──────┴──────┘