MCPcopy Create free account
hub / github.com/numpy/numpy / nanpercentile

Function nanpercentile

numpy/lib/nanfunctions.py:1229–1385  ·  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. .. versionadded:: 1.9.0 Parameters ---------- a : array_like Input array or object that can be converted to an arra

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 1

_nanquantile_uncheckedFunction · 0.85

Tested by

no test coverage detected