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

Function nanpercentile

numpy/lib/_nanfunctions_impl.py:1227–1397  ·  view source on GitHub ↗

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

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

Source from the content-addressed store, hash-verified

1225
1226@array_function_dispatch(_nanpercentile_dispatcher)
1227def nanpercentile(
1228 a,
1229 q,
1230 axis=None,
1231 out=None,
1232 overwrite_input=False,
1233 method="linear",
1234 keepdims=np._NoValue,
1235 *,
1236 weights=None,
1237):
1238 """
1239 Compute the qth percentile of the data along the specified axis,
1240 while ignoring nan values.
1241
1242 Returns the qth percentile(s) of the array elements.
1243
1244 Parameters
1245 ----------
1246 a : array_like
1247 Input array or object that can be converted to an array, containing
1248 nan values to be ignored.
1249 q : array_like of float
1250 Percentile or sequence of percentiles to compute, which must be
1251 between 0 and 100 inclusive.
1252 axis : {int, tuple of int, None}, optional
1253 Axis or axes along which the percentiles are computed. The default
1254 is to compute the percentile(s) along a flattened version of the
1255 array.
1256 out : ndarray, optional
1257 Alternative output array in which to place the result. It must have
1258 the same shape and buffer length as the expected output, but the
1259 type (of the output) will be cast if necessary.
1260 overwrite_input : bool, optional
1261 If True, then allow the input array `a` to be modified by
1262 intermediate calculations, to save memory. In this case, the
1263 contents of the input `a` after this function completes is
1264 undefined.
1265 method : str, optional
1266 This parameter specifies the method to use for estimating the
1267 percentile. There are many different methods, some unique to NumPy.
1268 See the notes for explanation. The options sorted by their R type
1269 as summarized in the H&F paper [1]_ are:
1270
1271 1. 'inverted_cdf'
1272 2. 'averaged_inverted_cdf'
1273 3. 'closest_observation'
1274 4. 'interpolated_inverted_cdf'
1275 5. 'hazen'
1276 6. 'weibull'
1277 7. 'linear' (default)
1278 8. 'median_unbiased'
1279 9. 'normal_unbiased'
1280
1281 The first three methods are discontinuous. NumPy further defines the
1282 following discontinuous variations of the default 'linear' (7.) option:
1283
1284 * 'lower'

Callers 1

test_result_valuesMethod · 0.85

Calls 3

_weights_are_validFunction · 0.90
_nanquantile_uncheckedFunction · 0.85
anyMethod · 0.45

Tested by 1

test_result_valuesMethod · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…