MCPcopy Index your code
hub / github.com/numpy/numpy / nanquantile

Function nanquantile

numpy/lib/_nanfunctions_impl.py:1406–1574  ·  view source on GitHub ↗

Compute the qth quantile of the data along the specified axis, while ignoring nan values. Returns the qth quantile(s) of the array elements. Parameters ---------- a : array_like Input array or object that can be converted to an array, containing nan values t

(
        a,
        q,
        axis=None,
        out=None,
        overwrite_input=False,
        method="linear",
        keepdims=np._NoValue,
        *,
        weights=None,
)

Source from the content-addressed store, hash-verified

1404
1405@array_function_dispatch(_nanquantile_dispatcher)
1406def nanquantile(
1407 a,
1408 q,
1409 axis=None,
1410 out=None,
1411 overwrite_input=False,
1412 method="linear",
1413 keepdims=np._NoValue,
1414 *,
1415 weights=None,
1416):
1417 """
1418 Compute the qth quantile of the data along the specified axis,
1419 while ignoring nan values.
1420 Returns the qth quantile(s) of the array elements.
1421
1422 Parameters
1423 ----------
1424 a : array_like
1425 Input array or object that can be converted to an array, containing
1426 nan values to be ignored
1427 q : array_like of float
1428 Probability or sequence of probabilities for the quantiles to compute.
1429 Values must be between 0 and 1 inclusive.
1430 axis : {int, tuple of int, None}, optional
1431 Axis or axes along which the quantiles are computed. The
1432 default is to compute the quantile(s) along a flattened
1433 version of the array.
1434 out : ndarray, optional
1435 Alternative output array in which to place the result. It must
1436 have the same shape and buffer length as the expected output,
1437 but the type (of the output) will be cast if necessary.
1438 overwrite_input : bool, optional
1439 If True, then allow the input array `a` to be modified by intermediate
1440 calculations, to save memory. In this case, the contents of the input
1441 `a` after this function completes is undefined.
1442 method : str, optional
1443 This parameter specifies the method to use for estimating the
1444 quantile. There are many different methods, some unique to NumPy.
1445 See the notes for explanation. The options sorted by their R type
1446 as summarized in the H&F paper [1]_ are:
1447
1448 1. 'inverted_cdf'
1449 2. 'averaged_inverted_cdf'
1450 3. 'closest_observation'
1451 4. 'interpolated_inverted_cdf'
1452 5. 'hazen'
1453 6. 'weibull'
1454 7. 'linear' (default)
1455 8. 'median_unbiased'
1456 9. 'normal_unbiased'
1457
1458 The first three methods are discontinuous. NumPy further defines the
1459 following discontinuous variations of the default 'linear' (7.) option:
1460
1461 * 'lower'
1462 * 'higher',
1463 * 'midpoint'

Callers

nothing calls this directly

Calls 3

_weights_are_validFunction · 0.90
_nanquantile_uncheckedFunction · 0.85
anyMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…