Skip to content

Quantile

Source code

Description

Aggregate the columns in the DataFrame to a unique quantile value. Use $describe() to specify several quantiles.

Usage

<LazyFrame>$quantile(quantile, interpolation = "nearest")

Arguments

quantile Numeric of length 1 between 0 and 1.
interpolation One of “nearest”, “higher”, “lower”, “midpoint”, or “linear”.

Value

LazyFrame

Examples

library(polars)

pl$LazyFrame(mtcars)$quantile(.4)$collect()
#> shape: (1, 11)
#> ┌──────┬─────┬───────┬───────┬───┬─────┬─────┬──────┬──────┐
#> │ mpg  ┆ cyl ┆ disp  ┆ hp    ┆ … ┆ vs  ┆ am  ┆ gear ┆ carb │
#> │ ---  ┆ --- ┆ ---   ┆ ---   ┆   ┆ --- ┆ --- ┆ ---  ┆ ---  │
#> │ f64  ┆ f64 ┆ f64   ┆ f64   ┆   ┆ f64 ┆ f64 ┆ f64  ┆ f64  │
#> ╞══════╪═════╪═══════╪═══════╪═══╪═════╪═════╪══════╪══════╡
#> │ 17.8 ┆ 6.0 ┆ 160.0 ┆ 110.0 ┆ … ┆ 0.0 ┆ 0.0 ┆ 3.0  ┆ 2.0  │
#> └──────┴─────┴───────┴───────┴───┴─────┴─────┴──────┴──────┘