pandas 1.4.2

ParametersReturnsBackRef
quantile(self, q=0.5, interpolation='linear')

Parameters

q : float or array-like, default 0.5 (50% quantile)

The quantile(s) to compute, which can lie in range: 0 <= q <= 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 :None:None:`j`:

  • linear: :None:None:`i + (j - i) * fraction`, where :None:None:`fraction` is the fractional part of the index surrounded by i and :None:None:`j`.

  • lower: i.

  • higher: :None:None:`j`.

  • nearest: i or :None:None:`j` whichever is nearest.

  • midpoint: (i + :None:None:`j`) / 2.

Returns

float or Series

If 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.

Return value at the given quantile.

See Also

core.window.Rolling.quantile

Calculate the rolling quantile.

numpy.percentile

Returns the q-th percentile(s) of the array elements.

Examples

This example is valid syntax, but we were not able to check execution
>>> s = pd.Series([1, 2, 3, 4])
... s.quantile(.5) 2.5
This example is valid syntax, but we were not able to check execution
>>> s.quantile([.25, .5, .75])
0.25    1.75
0.50    2.50
0.75    3.25
dtype: float64
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

pandas.core.window.expanding.Expanding.quantile pandas.core.groupby.groupby.GroupBy.quantile pandas.core.window.rolling.Rolling.quantile

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


File: /pandas/core/series.py#2449
type: <class 'function'>
Commit: