This is documentation for an old release of SciPy (version 0.11.0). Read this page in the documentation of the latest stable release (version 1.15.1).
Calculate the score at the given per percentile of the sequence a.
For example, the score at per=50 is the median. If the desired quantile lies between two data points, we interpolate between them, according to the value of interpolation. If the parameter limit is provided, it should be a tuple (lower, upper) of two values. Values of a outside this (closed) interval will be ignored.
The interpolation_method parameter supports three values, namely fraction (default), lower and higher. Interpolation is done only, if the desired quantile lies between two data points i and j. For fraction, the result is an interpolated value between i and j; for lower, the result is i, for higher the result is j.
Parameters : | a : ndarray
per : scalar
limit : tuple, optional
interpolation : {‘fraction’, ‘lower’, ‘higher’}, optional
|
---|---|
Returns : | score : float
|
See also
Examples
>>> from scipy import stats
>>> a = np.arange(100)
>>> stats.scoreatpercentile(a, 50)
49.5