# pandas.core.window.Rolling.quantile¶

Calculate the rolling quantile.

param quantile
float

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

param 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 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.

**kwargs: For compatibility with other rolling methods. Has no effect on the result.

return

Series or DataFrame Returned object type is determined by the caller of the rolling calculation.

## Limitations¶

This function may reveal slower performance than Pandas* on user system. Users should exercise a tradeoff between staying in JIT-region with that function or going back to interpreter mode. Supported interpolation only can be ‘linear’. DataFrame/Series elements cannot be max/min float/integer. Otherwise SDC and Pandas results are different.

## Examples¶

Calculate the rolling quantile.
import pandas as pd
from numba import njit

@njit
def series_rolling_quantile():
series = pd.Series([4, 3, 5, 2, 6])  # Series of 4, 3, 5, 2, 6
out_series = series.rolling(3).quantile(0.25)

return out_series  # Expect series of NaN, NaN, 3.5, 2.5, 3.5

print(series_rolling_quantile())

$python ./series/rolling/series_rolling_quantile.py 0 NaN 1 NaN 2 3.5 3 2.5 4 3.5 dtype: float64  Calculate the rolling quantile. import pandas as pd from numba import njit @njit def df_rolling_quantile(): df = pd.DataFrame({'A': [4, 3, 5, 2, 6], 'B': [-4, -3, -5, -2, -6]}) out_df = df.rolling(3).quantile(0.25) # Expect DataFrame of # {'A': [NaN, NaN, 3.5, 2.5, 3.5], 'B': [NaN, NaN, -4.5, -4.0, -5.5]} return out_df print(df_rolling_quantile())  $ python ./dataframe/rolling/dataframe_rolling_quantile.py
A    B
0  NaN  NaN
1  NaN  NaN
2  3.5 -4.5
3  2.5 -4.0
4  3.5 -5.5


See also

Series.rolling

Calling object with a Series.

DataFrame.rolling

Calling object with a DataFrame.

Series.quantile

Similar method for Series.

DataFrame.quantile

Similar method for DataFrame.