Previous topic

kendalltau

Next topic

mlinregress

This Page

percentile

numeric.stats.percentile(a, q, axis=None)

Compute the qth percentile of the data along the specified axis.

Parameters:
  • a – (array_like) Input array.
  • q – (float) float in range of [0,100]. Percentile to compute, which must be between 0 and 100 inclusive.
  • axis – (int) Axis or axes along which the percentiles are computed. The default is to compute the percentile along a flattened version of the array.
Returns:

(float) qth percentile value.

Examples:

>>> a = array([[10, 7, 4], [3, 2, 1]])
>>> a
array([[10, 7, 4]
      [3, 2, 1]])
>>> percentile(a, 50)
3.5
>>> percentile(a, 50, axis=0)
array([6.5, 4.5, 2.5])
>>> percentile(a, 50, axis=1)
array([7.0, 2.0])