numpy 计算两个数字的欧氏距离

# Input
a = np.array([1,2,3,4,5])
b = np.array([4,5,6,7,8])

# Solution
dist = np.linalg.norm(a-b)
print(dist)
# > 6.7082039324993694

 

你可能感兴趣的:(python,python,numpy)