blosc2.sum#

blosc2.sum(ndarr: NDArray | NDField | C2Array, axis=None, dtype=None, keepdims=False, **kwargs)#

Return the sum of array elements over a given axis.

Parameters:
  • ndarr (NDArray or NDField or C2Array or LazyExpr) – The input array or expression.

  • axis (int or tuple of ints, optional) – Axis or axes along which a sum is performed. The default, axis=None, will sum all the elements of the input array. If axis is negative it counts from the last to the first axis.

  • dtype (np.dtype, optional) – The type of the returned array and of the accumulator in which the elements are summed. The dtype of ndarr is used by default unless it has an integer dtype of less precision than the default platform integer.

  • keepdims (bool, optional) – If this is set to True, the axes which are reduced are left in the result as dimensions with size one. With this option, the result will broadcast correctly against the input array.

  • kwargs (dict, optional) – Keyword arguments that are supported by the empty() constructor.

Returns:

sum_along_axis – The sum of the elements along the axis.

Return type:

np.ndarray or NDArray or scalar

References

np.sum