blosc2.max#
- blosc2.max(ndarr: NDArray | NDField | C2Array | LazyExpr, axis: int | tuple[int] = None, keepdims: bool = False, **kwargs: dict) ndarray | NDArray | int | float | complex | bool #
Return the maximum along 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 to operate. By default, flattened input is used.
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:
max_along_axis – The maximum of the elements along the axis.
- Return type:
np.ndarray or NDArray or scalar
References
Examples
>>> import blosc2 >>> import numpy as np >>> data = np.array([[11, 2, 36, 24, 5, 69], [73, 81, 49, 6, 73, 0]]) >>> ndarray = blosc2.asarray(data) >>> print("NDArray data:", ndarray[:]) NDArray data: [[11 2 36 24 5 69] [73 81 49 6 73 0]] >>> # Compute the maximum along axis 0 and 1 >>> max_along_axis_0 = blosc2.max(ndarray, axis=0) >>> print("Maximum along axis 0:", max_along_axis_0) Maximum along axis 0: [73 81 49 24 73 69] >>> max_along_axis_1 = blosc2.max(ndarray, axis=1) >>> print("Maximum along axis 1:", max_along_axis_1) Maximum along axis 1: [69 81] >>> max_flattened = blosc2.max(ndarray) >>> print("Maximum of the flattened array:", max_flattened) Maximum of the flattened array: 81