databricks.koalas.Series.quantile

Series.quantile(q=0.5, accuracy=10000)[source]

Return value at the given quantile.

Note

Unlike pandas’, the quantile in Koalas is an approximated quantile based upon approximate percentile computation because computing quantile across a large dataset is extremely expensive.

Parameters
qfloat or array-like, default 0.5 (50% quantile)

0 <= q <= 1, the quantile(s) to compute.

accuracyint, optional

Default accuracy of approximation. Larger value means better accuracy. The relative error can be deduced by 1.0 / accuracy.

Returns
float or Series

If the current object is a Series and q is an array, a Series will be returned where the index is q and the values are the quantiles, otherwise a float will be returned.

Examples

>>> s = ks.Series([1, 2, 3, 4, 5])
>>> s.quantile(.5)
3
>>> (s + 1).quantile(.5)
4
>>> s.quantile([.25, .5, .75])
0.25    2
0.5     3
0.75    4
Name: 0, dtype: int64
>>> (s + 1).quantile([.25, .5, .75])
0.25    3
0.5     4
0.75    5
Name: 0, dtype: int64