blosc2.mean#

blosc2.mean(ndarr: NDArray | NDField | C2Array | LazyExpr, axis: int | tuple[int] | None = None, dtype: dtype | str = None, keepdims: bool = False, **kwargs: Any) ndarray | NDArray | int | float | complex | bool#

Return the arithmetic mean along the specified axis.

The parameters are documented in the sum.

Returns:

mean_along_axis – The mean of the elements along the axis.

Return type:

np.ndarray or NDArray or scalar

References

np.mean

Examples

>>> import numpy as np
>>> import blosc2
>>> # Example array
>>> array = np.array([[1, 2, 3], [4, 5, 6]]
>>> nd_array = blosc2.asarray(array)
>>> # Compute the mean of all elements in the array (axis=None)
>>> overall_mean = blosc2.mean(nd_array)
>>> print("Mean of all elements:", overall_mean)
Mean of all elements: 3.5