Skip to content

Quantile

Source code

Description

Aggregate the columns in the DataFrame to their quantile value.

Usage

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

Arguments

quantile numeric Quantile between 0.0 and 1.0.
interpolation string Interpolation method: "nearest", "higher", "lower", "midpoint", or "linear".

Value

GroupBy

Examples

library(polars)

pl$DataFrame(mtcars)$lazy()$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  │
#> └──────┴─────┴───────┴───────┴───┴─────┴─────┴──────┴──────┘