pandas 1.4.2

ParametersReturns
quantile(self, quantile: 'float', interpolation: 'str' = 'linear', **kwargs)

Parameters

quantile : float

Quantile to compute. 0 <= quantile <= 1.

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 :None:None:`j`:

  • linear: :None:None:`i + (j - i) * fraction`, where :None:None:`fraction` is the fractional part of the index surrounded by i and :None:None:`j`.

  • lower: i.

  • higher: :None:None:`j`.

  • nearest: i or :None:None:`j` whichever is nearest.

  • midpoint: (i + :None:None:`j`) / 2.

**kwargs :

For NumPy compatibility and will not have an effect on the result.

Returns

Series or DataFrame

Return type is the same as the original object with np.float64 dtype.

Calculate the rolling quantile.

See Also

pandas.DataFrame.quantile

Aggregating quantile for DataFrame.

pandas.DataFrame.rolling

Calling rolling with DataFrames.

pandas.Series.quantile

Aggregating quantile for Series.

pandas.Series.rolling

Calling rolling with Series data.

Examples

This example is valid syntax, but we were not able to check execution
>>> 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
This example is valid syntax, but we were not able to check execution
>>> s.rolling(2).quantile(.4, interpolation='midpoint')
0    NaN
1    1.5
2    2.5
3    3.5
dtype: float64
See :

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


File: /pandas/core/window/rolling.py#2298
type: <class 'function'>
Commit: