This is a pre-release version (2.0.0.dev0+git20260907.41eeb59).Go to latest (1.18.0)
{ } Raw JSON

bundles / scipy 2.0.0.dev0+git20260907.41eeb59 / scipy / _external / array_api_extra / _delegation / nanmax

function

scipy._external.array_api_extra._delegation:nanmax

source: build-install/usr/lib/python3.14/site-packages/scipy/_external/array_api_extra/_delegation.py:1780

Signature

def nanmax(a: Array, /, axis: int | tuple[int, ...] | None = None, xp: ArrayNamespace | None = None) → Array

Summary

Return the maximum of the array elements along a given axis, ignoring NaNs.

Parameters

a : Array

Input array.

axis : int or tuple of ints or None, optional

Axis or axes along which the maximum is computed. The default is to compute the maximum of the flattened array.

xp : array_namespace, optional

The standard-compatible namespace for a. Default: infer.

Returns

: array

An array of maximum values along the given axis, ignoring NaNs.

Examples

import array_api_extra as xpx
import array_api_strict as xp
a = xp.asarray([[5, 3, xp.nan, 6], [4, xp.nan, 2, xp.nan]])
xpx.nanmax(a)
xpx.nanmax(a, axis=0)
xpx.nanmax(a, axis=1)
⚠
Traceback (most recent call last):
  File "<doctest scipy._external.array_api_extra._delegation:nanmax[0]>", line 1, in <module>
    xpx.nanmax(a, axis=1)
    ^^^
NameError: name 'xpx' is not defined

Aliases

  • scipy.differentiate.xpx.nanmax