> ## Documentation Index
> Fetch the complete documentation index at: https://docs.activeviam.com/llms.txt
> Use this file to discover all available pages before exploring further.

# quantile_index()

<span id="atoti.array.quantile_index" />

> atoti.array.quantile\_index(<br />
>     *measure*: VariableMeasureConvertible,<br />
>     /,<br />
>     *q*: \_Quantile,<br />
>     \*,<br />
>     *mode*: [Literal](https://docs.python.org/3/library/typing.html#typing.Literal)\['simple', 'centered', 'inc', 'exc'] = `'inc'`,<br />
>     *interpolation*: [Literal](https://docs.python.org/3/library/typing.html#typing.Literal)\['higher', 'lower', 'nearest'] = `'lower'`,<br />
> ) → MeasureDefinition

Return a measure equal to the index of requested quantile of the elements of the passed array measure.

### Parameters

<h4 id="atoti.array.quantile_index.measure">
  *measure*
</h4>

The measure to get the quantile of.

<h4 id="atoti.array.quantile_index.q">
  *q*
</h4>

The quantile to take.
For instance, `0.95` is the 95th percentile and `0.5` is the median.

<h4 id="atoti.array.quantile_index.mode">
  *mode*
</h4>

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`

<h4 id="atoti.array.quantile_index.interpolation">
  *interpolation*
</h4>

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`
