EAPExprNamespace.quantile

eap_pl.EAPExprNamespace.quantile(prob, *, method='linear')

Estimate a sample quantile within the current group.

Parameters

Name Type Description Default
prob float Probability on the scale from 0 to 1. required
method str "linear" uses Polars’ linear quantile (R type 7). "stata" and "r" follow StatsPAI 1.47.0’s implementations of Stata’s _pctile and R’s quantile(type = 2). They can differ at some percentiles because of floating-point rounding. The other NumPy method names are "inverted_cdf", "averaged_inverted_cdf", "closest_observation", "interpolated_inverted_cdf", "hazen", "weibull", "median_unbiased", and "normal_unbiased" (R types 1–6 and 8–9 in that order, using NumPy’s arithmetic). Four variants of "linear" are also available: "lower", "higher", "midpoint", and "nearest". NumPy percentile methods. 'linear'

Returns

Name Type Description
polars.Expr Quantile expression suitable for grouped aggregations or window expressions.

Notes

The NumPy, R, and Stata calculations omit nulls and NaNs. Linear interpolation follows Polars’ missing-value handling. Filter infinite values before calling if they should be excluded from the reference sample. With "stata", the probability’s decimal representation is converted to the percentage scale used by _pctile. StatsPAI 1.47.0.