polars.DataFrame.quantile¶
- DataFrame.quantile(quantile: float, interpolation: str = 'nearest') polars.internals.frame.DF ¶
Aggregate the columns of this DataFrame to their quantile value.
- Parameters
- quantile
quantile between 0.0 and 1.0
- interpolation
interpolation type, options: [‘nearest’, ‘higher’, ‘lower’, ‘midpoint’, ‘linear’]
Examples
>>> df = pl.DataFrame( ... { ... "foo": [1, 2, 3], ... "bar": [6, 7, 8], ... "ham": ["a", "b", "c"], ... } ... ) >>> df.quantile(0.5, "nearest") shape: (1, 3) ┌─────┬─────┬──────┐ │ foo ┆ bar ┆ ham │ │ --- ┆ --- ┆ --- │ │ i64 ┆ i64 ┆ str │ ╞═════╪═════╪══════╡ │ 2 ┆ 7 ┆ null │ └─────┴─────┴──────┘