Numpy: abs value on a Numpy array



examples/numpy/abs_on_np.py
import numpy as np

a = np.array([[-1, 2, -3], [-4, 5, -7]])
print(a)
print(a.dtype)
print()

abs_a = np.absolute(a)
print(abs_a)
print(abs_a.dtype)
print()
print(a)

[[-1  2 -3]
 [-4  5 -7]]
int64

[[1 2 3]
 [4 5 7]]
int64

[[-1  2 -3]
 [-4  5 -7]]