nanpercentile#
- class brainunit.math.nanpercentile(a, q, axis=None, method='linear', keepdims=False, **kwargs)#
Compute the q-th percentile of the data along the specified axis, while ignoring nan values.
Returns the q-th percentile(s) of the array elements, while ignoring nan values.
- Parameters:
a (
Array| saiunit.Quantity) – Input array or Quantity.q (
Array|ndarray|bool|number|bool|int|float|complex) – Percentile or sequence of percentiles to compute, which must be between 0 and 100 inclusive.method (
str) –This parameter specifies the method to use for estimating the percentile. There are many different methods, some unique to NumPy. See the notes for explanation. The options sorted by their R type as summarized in the H&F paper (Hyndman & Fan, 1996) are:
’inverted_cdf’
’averaged_inverted_cdf’
’closest_observation’
’interpolated_inverted_cdf’
’hazen’
’weibull’
’linear’ (default)
’median_unbiased’
’normal_unbiased’
The first three methods are discontinuous. NumPy further defines the following discontinuous variations of the default ‘linear’ (7.) option:
’lower’
’higher’,
’midpoint’
’nearest’
keepdims (
bool|None) – If this is set to True, the axes which are reduced are left in the result as dimensions with size one.
- Returns:
out – Output array.
- Return type:
Array
Examples
>>> import saiunit as u >>> import jax.numpy as jnp >>> a = [1.0, jnp.nan, 3.0, 4.0, 5.0] * u.meter >>> u.math.nanpercentile(a, 50)