blosc2.any#
- blosc2.any(ndarr: NDArray | NDField | C2Array | LazyExpr, axis: int | tuple[int] | None = None, keepdims: bool = False, **kwargs: dict) ndarray | NDArray | bool #
Test whether any array element along a given axis evaluates to True.
The parameters are documented in the
min
.- Returns:
any_along_axis – The result of the evaluation along the axis.
- Return type:
np.ndarray or NDArray or scalar
References
Examples
>>> import blosc2 >>> import numpy as np >>> data = np.array([[1, 0, 0], [0, 1, 0], [0, 0, 0]]) >>> # Convert the NumPy array to a Blosc2 NDArray >>> ndarray = blosc2.asarray(data) >>> print("NDArray data:", ndarray[:]) NDArray data: [[1 0 0] [0 1 0] [0 0 0]] >>> any_along_axis_0 = blosc2.any(ndarray, axis=0) >>> print("Any along axis 0:", any_along_axis_0) Any along axis 0: [True True False] >>> any_flattened = blosc2.any(ndarray) >>> print("Any in the flattened array:", any_flattened) Any in the flattened array: True