modin.pandas.Series.quantile¶
- Series.quantile(q=0.5, interpolation='linear') Union[float, Series] [source] (https://github.com/snowflakedb/snowpark-python/blob/v1.26.0/snowpark-python/.tox/docs/lib/python3.9/site-packages/modin/pandas/series.py#L1813-L1825)¶
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 isq
and the values are the quantiles. Ifq
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])
With a scalar q:
>>> s.quantile(.5) 2.5
With a list q:
>>> s.quantile([.25, .5, .75]) 0.25 1.75 0.50 2.50 0.75 3.25 dtype: float64
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