nums.numpy.median

nums.numpy.median(a, axis=None, out=None, keepdims=False)[source]

Compute the median along the specified axis.

This docstring was copied from numpy.median.

Some inconsistencies with the NumS version may exist.

Returns the median of the array elements.

Parameters
  • a (BlockArray) – Input array or object that can be converted to an array.

  • axis ({int, sequence of int, None}, optional) – Axis or axes along which the medians are computed. The default is to compute the median along a flattened version of the array.

  • out (BlockArray, 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.

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

Returns

median – A new array holding the result. If the input contains integers or floats smaller than float64, then the output data-type is nps.float64. Otherwise, the data-type of the output is the same as that of the input. If out is specified, that array is returned instead.

Return type

BlockArray

See also

mean, percentile

Notes

Given a vector V of length N, the median of V is the middle value of a sorted copy of V, V_sorted - i e., V_sorted[(N-1)/2], when N is odd, and the average of the two middle values of V_sorted when N is even.

‘axis’ is currently not supported.

‘out’ is currently not supported.

‘keepdims’ is currently not supported.