scipy.stats.scoreatpercentile

scipy.stats.scoreatpercentile(a, per, limit=())

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

Parameters :

a : ndarray

Values from which to extract score.

per : int or float

Percentile at which to extract score.

limit : tuple, optional

Tuple of two scalars, the lower and upper limits within which to compute the percentile.

Returns :

score : float

Score at percentile.

Examples

>>> from scipy import stats
>>> a = np.arange(100)
>>> stats.scoreatpercentile(a, 50)
49.5

Previous topic

scipy.stats.itemfreq

Next topic

scipy.stats.percentileofscore

This Page