Skip to main content
`Ctrl`+`K`

# pandas.api.typing.Expanding.quantile

Expanding.quantile(q, interpolation='linear', numeric_only=False)

  Calculate the expanding quantile.

  Parameters:
    q 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 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_only bool, default False

      Include only float, int, boolean columns.

  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(0.25)
      a     NaN
      b     NaN
      c     NaN
      d    1.75
      e    2.00
      f    2.25
      dtype: float64