Skip to main content
atoti.array.quantile_index(
    measure: VariableMeasureConvertible,
    /,
    q: _Quantile,
    *,
    mode: Literal[‘simple’, ‘centered’, ‘inc’, ‘exc’] = 'inc',
    interpolation: Literal[‘higher’, ‘lower’, ‘nearest’] = 'lower',
) → MeasureDefinition
Return a measure equal to the index of requested quantile of the elements of the passed array measure.

Parameters

measure

The measure 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 vector X:
  • simple: len(X) * q
  • centered: len(X) * q + 0.5
  • exc: (len(X) + 1) * q
  • inc: (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 index k with i < k < j for the original vector X and the sorted vector Y:
  • lowest: the index in X of Y[i]
  • highest: the index in X of Y[j]
  • nearest: the index in X of Y[i] or Y[j] depending on which of i or j is closest to k