cudf.Series.quantile#
- Series.quantile(q=0.5, interpolation='linear', exact=True, quant_index=True)[source]#
Return values at the given quantile.
- Parameters:
- qfloat or array-like, default 0.5 (50% quantile)
0 <= q <= 1, the quantile(s) to compute
- 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.
- exactboolean
Whether to use approximate or exact quantile algorithm.
- quant_indexboolean
Whether to use the list of quantiles as index.
- Returns:
- float or Series
If
q
is an array, a Series will be returned where the index isq
and the values are the quantiles, otherwise a float will be returned.
Examples
>>> import cudf >>> series = cudf.Series([1, 2, 3, 4]) >>> series 0 1 1 2 2 3 3 4 dtype: int64 >>> series.quantile(0.5) 2.5 >>> series.quantile([0.25, 0.5, 0.75]) 0.25 1.75 0.50 2.50 0.75 3.25 dtype: float64