nanreduce

sparse.nanreduce(x, method, identity=None, axis=None, keepdims=False, **kwargs)[source]

Performs an NaN skipping reduction on this array. See the documentation on COO.reduce for examples.

Parameters:
  • x (COO) – The array to reduce.

  • method (numpy.ufunc) – The method to use for performing the reduction.

  • identity (numpy.number) – The identity value for this reduction. Inferred from method if not given. Note that some ufunc objects don’t have this, so it may be necessary to give it.

  • axis (Union[int, Iterable[int]], optional) – The axes along which to perform the reduction. Uses all axes by default.

  • keepdims (bool, optional) – Whether or not to keep the dimensions of the original array.

  • **kwargs (dict) – Any extra arguments to pass to the reduction operation.

Returns:

The result of the reduction operation.

Return type:

COO

Raises:

ValueError – If reducing an all-zero axis would produce a nonzero result.

See also

COO.reduce

Similar method without NaN skipping functionality.