Return value at the given quantile.

param q
float or array-like, default 0.5 (50% quantile)

0 <= q <= 1, the quantile(s) to compute.

param interpolation
{‘linear’, ‘lower’, ‘higher’, ‘midpoint’, ‘nearest’}

New in version 0.18.0.

This optional parameter specifies the interpolation method to use, when the desired quantile lies between two data points i and j:

  • linear: i + (j - i) * fraction, where fraction is the

    fractional part of the index surrounded by i and j.

  • lower: i.

  • higher: j.

  • nearest: i or j whichever is nearest.

  • midpoint: (i + j) / 2.


float or Series If q is an array, a Series will be returned where the index is q and the values are the quantiles, otherwise a float will be returned.


Parameter interpolation is currently unsupported.


Computing quantile for the Series
import pandas as pd
from numba import njit

def series_quantile():
    s = pd.Series([1, 2, 3, 4])
    median = .5  # compute median
    out_series = s.quantile(median)

    return out_series # Expect median value == 2.5

$ python ./series/

See also


Calculate the rolling quantile.


Compute the q-th percentile of the data along the specified axis.