@overload
atoti.agg.quantile(
operand: LevelOrVariableColumnConvertible,
/,
q: _Quantile,
*,
mode: Literal[‘simple’, ‘centered’, ‘inc’, ‘exc’] ='inc',
interpolation: Literal[‘linear’, ‘higher’, ‘lower’, ‘nearest’, ‘midpoint’] ='linear',
) → MeasureDefinition
@overloadReturn a measure equal to the requested quantile of the passed operand across the specified scope. Here is how to obtain the same behavior as these standard quantile calculation methods:
atoti.agg.quantile(
operand: VariableMeasureConvertible,
/,
q: _Quantile,
*,
mode: Literal[‘simple’, ‘centered’, ‘inc’, ‘exc’] ='inc',
interpolation: Literal[‘linear’, ‘higher’, ‘lower’, ‘nearest’, ‘midpoint’] ='linear',
scope: CumulativeScope | SiblingsScope | OriginScope,
) → MeasureDefinition
- R-1:
mode="centered"andinterpolation="lower" - R-2:
mode="centered"andinterpolation="midpoint" - R-3:
mode="simple"andinterpolation="nearest" - R-4:
mode="simple"andinterpolation="linear" - R-5:
mode="centered"andinterpolation="linear" - R-6 (similar to Excel’s
PERCENTILE.EXC):mode="exc"andinterpolation="linear" - R-7 (similar to Excel’s
PERCENTILE.INC):mode="inc"andinterpolation="linear" - R-8 and R-9 are not supported
Parameters
operand
The operand to get the quantile of.q
The quantile to take. For instance,0.95 is the 95th percentile and 0.5 is the median.
mode
The method used to calculate the index of the quantile. Available options are, when searching for the q quantile of a vectorX:
simple:len(X) * qcentered:len(X) * q + 0.5exc:(len(X) + 1) * qinc:(len(X) - 1) * q + 1
interpolation
If the quantile index is not an integer, the interpolation decides what value is returned. The different options are, considering a quantile indexk with i < k < j for a sorted vector X:
linear:v = X[i] + (X[j] - X[i]) * (k - i)lower:v = X[i]higher:v = X[j]nearest:v = X[i]orv = X[j]depending on which ofiorjis closest tokmidpoint:v = (X[i] + X[j]) / 2
scope
Theaggregation scope.