modin.pandas.Series.quantile

Series.quantile(q=0.5, interpolation='linear')[source]

Return value at the given quantile.

Parameters:
  • q (float or array-like of float, default 0.5) – Value between 0 <= q <= 1, the quantile(s) to compute. Currently unsupported if q is a Snowpandas DataFrame or Series.

  • interpolation ({"linear", "lower", "higher", "midpoint", "nearest"}, default "linear") –

    Specifies the interpolation method to use if a 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.

    Snowpark pandas currently only supports “linear” and “nearest”.

Returns:

If q is an array, a Series will be returned where the index is q and the values are the quantiles. If q is a float, the float value of that quantile will be returned.

Return type:

float or Series

Examples

>>> s = pd.Series([1, 2, 3, 4])
Copy

With a scalar q:

>>> s.quantile(.5)
2.5
Copy

With a list q:

>>> s.quantile([.25, .5, .75]) 
0.25    1.75
0.50    2.50
0.75    3.25
dtype: float64
Copy

Values considered NaN do not affect the result:

>>> s = pd.Series([None, 0, 25, 50, 75, 100, np.nan])
>>> s.quantile([0, 0.25, 0.5, 0.75, 1]) 
0.00      0.0
0.25     25.0
0.50     50.0
0.75     75.0
1.00    100.0
dtype: float64
Copy