blosc2.abs#
- blosc2.abs(ndarr: NDArray | NDField | C2Array | LazyExpr, /) LazyExpr #
Calculate the absolute value element-wise.
- Parameters:
ndarr¶ (NDArray or NDField or C2Array or LazyExpr) – The input array.
- Returns:
out – A lazy expression that can be evaluated to get the absolute values.
- Return type:
References
Examples
>>> import numpy as np >>> import blosc2 >>> values = np.array([-5, -3, 0, 2, 4]) >>> ndarray = blosc2.asarray(values) >>> result_ = blosc2.abs(ndarray) >>> result = result_[:] >>> print("Original values:", values) Original values: [-5 -3 0 2 4] >>> print("Absolute values:", result) Absolute values: [5. 3. 0. 2. 4.]