How to calculate the absolute value of the difference between two arrays in Python

1 Answer

0 votes
import numpy as np

arr1 = np.array([2,  4,  6,  8, 10])
arr2 = np.array([8, 12, 10, 16, 18])

euclidean_distance = np.sum(np.abs(arr1 - arr2))

print(euclidean_distance)





'''
run:

34

'''

 



answered Mar 2, 2023 by avibootz

Related questions

1 answer 145 views
1 answer 97 views
1 answer 145 views
...