bundles / scipy 2.0.0.dev0+git20260907.41eeb59 / scipy / _external / array_api_extra / _delegation / nansum
function
scipy._external.array_api_extra._delegation:nansum
source: build-install/usr/lib/python3.14/site-packages/scipy/_external/array_api_extra/_delegation.py:1831
Signature
def nansum(a: Array, /, axis: int | tuple[int, ...] | None = None, xp: ArrayNamespace | None = None) → ArraySummary
Return the sum of the array elements along a given axis, ignoring NaNs.
Parameters
a: ArrayInput array.
axis: int or tuple of ints or None, optionalAxis or axes along which the sum is computed. The default is to compute the sum of the flattened array.
xp: array_namespace, optionalThe standard-compatible namespace for
a. Default: infer.
Returns
: arrayAn array of sum 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, 1], [4, xp.nan, 2, xp.nan]]) xpx.nansum(a) xpx.nansum(a, axis=0) xpx.nansum(a, axis=1)⚠
Traceback (most recent call last):
File "<doctest scipy._external.array_api_extra._delegation:nansum[0]>", line 1, in <module>
xpx.nansum(a, axis=1)
^^^
NameError: name 'xpx' is not defined
Aliases
scipy.differentiate.xpx.nansum