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

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

Arguments

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

Value

DataFrame

Examples

library("polars")

as_polars_df(mtcars)$quantile(.4)
#> 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  │
#> └──────┴─────┴───────┴───────┴───┴─────┴─────┴──────┴──────┘