Pandas Series: quantile() function

Value at the given quantile

The quantile() function is used to get value at the given quantile.


Series.quantile(self, q=0.5, interpolation='linear')
Pandas Series quantile image


Name Description Type/Default Value Required / Optional
q 0 <= q <= 1, the quantile(s) to compute. float or array-like
Default Value: 0.5 (50% quantile)
interpolation 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.
{‘linear’, ‘lower’, ‘higher’, ‘midpoint’, ‘nearest’} Required

Returns: 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.


Download the Pandas Series Notebooks from here.

Previous: Product of the values for the requested Pandas axis
Next: Compute numerical data ranks along axis