pandas.core.window.Rolling.quantile
-
Rolling.quantile(quantile, interpolation='linear', **kwargs)[source] -
Calculate the rolling quantile.
Parameters: -
quantile : float -
Quantile to compute. 0 <= quantile <= 1.
-
interpolation : {‘linear’, ‘lower’, ‘higher’, ‘midpoint’, ‘nearest’} -
New in version 0.23.0.
This optional parameter specifies the interpolation method to use, when the desired quantile lies between two data points
iandj:- linear:
i + (j - i) * fraction, wherefractionis the fractional part of the index surrounded byiandj. - lower:
i. - higher:
j. - nearest:
iorjwhichever is nearest. - midpoint: (
i+j) / 2.
- linear:
- **kwargs:
-
For compatibility with other rolling methods. Has no effect on the result.
Returns: - Series or DataFrame
-
Returned object type is determined by the caller of the rolling calculation.
See also
-
pandas.Series.quantile - Computes value at the given quantile over all data in Series.
-
pandas.DataFrame.quantile - Computes values at the given quantile over requested axis in DataFrame.
Examples
>>> s = pd.Series([1, 2, 3, 4]) >>> s.rolling(2).quantile(.4, interpolation='lower') 0 NaN 1 1.0 2 2.0 3 3.0 dtype: float64
>>> s.rolling(2).quantile(.4, interpolation='midpoint') 0 NaN 1 1.5 2 2.5 3 3.5 dtype: float64
-
© 2008–2012, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team
Licensed under the 3-clause BSD License.
https://pandas.pydata.org/pandas-docs/version/0.24.2/reference/api/pandas.core.window.Rolling.quantile.html