nanmedian#
- class saiunit.math.nanmedian(x, axis=None, overwrite_input=False, keepdims=False, **kwargs)#
Return the median of the array elements, ignoring NaNs.
- Parameters:
x (saiunit.Quantity |
Array|ndarray|bool|number|bool|int|float|complex) – Input array.axis (
int|tuple[int,...] |None) – Axis or axes along which the medians are computed. The default is to compute the median along a flattened version of the array. A sequence of axes is supported since version 1.9.0.overwrite_input (
bool) – If True, then allow use of memory of input array a for calculations. The input array will be modified by the call to median. This will save memory when you do not need to preserve the contents of the input array. Treat the input as undefined, but it will probably be fully or partially sorted. Default is False. If overwrite_input isTrueand a is not already an ndarray, an error will be raised.keepdims (
bool) –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 a.
If this is anything but the default value it will be passed through (in the special case of an empty array) to the mean function of the underlying array. If the array is a sub-class and mean does not have the kwarg keepdims this will raise a RuntimeError.
- Returns:
out – Quantity if x is a Quantity, else an array.
- Return type:
saiunit.Quantity |
Array
Examples
>>> import saiunit as u >>> import jax.numpy as jnp >>> a = [1.0, jnp.nan, 3.0] * u.second >>> u.math.nanmedian(a)