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

Function nanmax

numpy/lib/_nanfunctions_impl.py:383–503  ·  view source on GitHub ↗

Return the maximum of an array or maximum along an axis, ignoring any NaNs. When all-NaN slices are encountered a ``RuntimeWarning`` is raised and NaN is returned for that slice. Parameters ---------- a : array_like Array containing numbers whose maximum is desired

(a, axis=None, out=None, keepdims=np._NoValue, initial=np._NoValue,
           where=np._NoValue)

Source from the content-addressed store, hash-verified

381
382@array_function_dispatch(_nanmax_dispatcher)
383def nanmax(a, axis=None, out=None, keepdims=np._NoValue, initial=np._NoValue,
384 where=np._NoValue):
385 """
386 Return the maximum of an array or maximum along an axis, ignoring any
387 NaNs. When all-NaN slices are encountered a ``RuntimeWarning`` is
388 raised and NaN is returned for that slice.
389
390 Parameters
391 ----------
392 a : array_like
393 Array containing numbers whose maximum is desired. If `a` is not an
394 array, a conversion is attempted.
395 axis : {int, tuple of int, None}, optional
396 Axis or axes along which the maximum is computed. The default is to compute
397 the maximum of the flattened array.
398 out : ndarray, optional
399 Alternate output array in which to place the result. The default
400 is ``None``; if provided, it must have the same shape as the
401 expected output, but the type will be cast if necessary. See
402 :ref:`ufuncs-output-type` for more details.
403 keepdims : bool, optional
404 If this is set to True, the axes which are reduced are left
405 in the result as dimensions with size one. With this option,
406 the result will broadcast correctly against the original `a`.
407 If the value is anything but the default, then
408 `keepdims` will be passed through to the `max` method
409 of sub-classes of `ndarray`. If the sub-classes methods
410 does not implement `keepdims` any exceptions will be raised.
411 initial : scalar, optional
412 The minimum value of an output element. Must be present to allow
413 computation on empty slice. See `~numpy.ufunc.reduce` for details.
414
415 .. versionadded:: 1.22.0
416 where : array_like of bool, optional
417 Elements to compare for the maximum. See `~numpy.ufunc.reduce`
418 for details.
419
420 .. versionadded:: 1.22.0
421
422 Returns
423 -------
424 nanmax : ndarray
425 An array with the same shape as `a`, with the specified axis removed.
426 If `a` is a 0-d array, or if axis is None, an ndarray scalar is
427 returned. The same dtype as `a` is returned.
428
429 See Also
430 --------
431 nanmin :
432 The minimum value of an array along a given axis, ignoring any NaNs.
433 amax :
434 The maximum value of an array along a given axis, propagating any NaNs.
435 fmax :
436 Element-wise maximum of two arrays, ignoring any NaNs.
437 maximum :
438 Element-wise maximum of two arrays, propagating any NaNs.
439 isnan :
440 Shows which elements are Not a Number (NaN).

Callers

nothing calls this directly

Calls 5

_replace_nanFunction · 0.85
_copytoFunction · 0.85
reduceMethod · 0.45
anyMethod · 0.45
allMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…