Write a NumPy program to calculate the absolute value element-wise.
import numpy as np x = np.array([-10.2, 122.2, .20]) print("Original array:") print(x) print("Element-wise absolute value:") print(np.absolute(x))
Sample Output:
Original array: [ -10.2 122.2 0.2] Element-wise absolute value: [ 10.2 122.2 0.2]
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
Sample Output:
need an explanation for this answer? contact us directly to get an explanation for this answer