pandas.core.window.expanding.Expanding.quantile#
- Expanding.quantile(q, interpolation='linear', numeric_only=False)[source]#
Calculate the expanding quantile.
- Parameters:
- qfloat
Quantile to compute. 0 <= quantile <= 1.
Deprecated since version 2.1.0: This was renamed from ‘quantile’ to ‘q’ in version 2.1.0.
- interpolation{‘linear’, ‘lower’, ‘higher’, ‘midpoint’, ‘nearest’}
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.
- numeric_onlybool, default False
Include only float, int, boolean columns.
Added in version 1.5.0.
- Returns:
- Series or DataFrame
Return type is the same as the original object with
np.float64
dtype.
See also
Series.expanding
Calling expanding with Series data.
DataFrame.expanding
Calling expanding with DataFrames.
Series.quantile
Aggregating quantile for Series.
DataFrame.quantile
Aggregating quantile for DataFrame.
Examples
>>> ser = pd.Series([1, 2, 3, 4, 5, 6], index=['a', 'b', 'c', 'd', 'e', 'f']) >>> ser.expanding(min_periods=4).quantile(.25) a NaN b NaN c NaN d 1.75 e 2.00 f 2.25 dtype: float64