numpy.percentile — NumPy v1.13 Manual (original) (raw)

a : array_like

Input array or object that can be converted to an array.

q : float in range of [0,100] (or sequence of floats)

Percentile to compute, which must be between 0 and 100 inclusive.

axis : {int, sequence of int, None}, optional

Axis or axes along which the percentiles are computed. The default is to compute the percentile(s) along a flattened version of the array. A sequence of axes is supported since version 1.9.0.

out : ndarray, optional

Alternative output array in which to place the result. It must have the same shape and buffer length as the expected output, but the type (of the output) will be cast if necessary.

overwrite_input : bool, optional

If True, then allow use of memory of input array a_calculations. The input array will be modified by the call topercentile. This will save memory when you do not need to preserve the contents of the input array. In this case you should not make any assumptions about the contents of the input_a after this function completes – treat it as undefined. Default is False. If a is not already an array, this parameter will have no effect as a will be converted to an array internally regardless of the value of this parameter.

interpolation : {‘linear’, ‘lower’, ‘higher’, ‘midpoint’, ‘nearest’}

This optional parameter specifies the interpolation method to use when the desired quantile lies between two data pointsi < j:

  • linear: i + (j - i) * fraction, where fractionis the fractional part of the index surrounded by iand j.
  • lower: i.
  • higher: j.
  • nearest: i or j, whichever is nearest.
  • midpoint: (i + j) / 2.

New in version 1.9.0.

keepdims : bool, optional

If this is set to True, the axes which are reduced are left in the result as dimensions with size one. With this option, the result will broadcast correctly against the original array a.

New in version 1.9.0.