Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Calculate Euclidean Distance in Python using norm()

# Python code to find Euclidean distance
# using linalg.norm()

# Import NumPy Library
import numpy as np

# initializing points in
# numpy arrays
point1 = np.array((4, 4, 2))
point2 = np.array((1, 2, 1))

# calculate Euclidean distance
# using linalg.norm() method
dist = np.linalg.norm(point1 - point2)

# printing Euclidean distance
print(dist)
Source by itsmycode.com #
 
PREVIOUS NEXT
Tagged: #Calculate #Euclidean #Distance #Python
ADD COMMENT
Topic
Name
5+2 =