Sometimes, we want to calculate the Euclidean distance with Python NumPy.
In this article, we’ll look at how to calculate the Euclidean distance with Python NumPy.
How to calculate the Euclidean distance with Python NumPy?
To calculate the Euclidean distance with Python NumPy, we use the numpy.linalg.norm method.
For instance, we write
dist = numpy.linalg.norm(a - b)
to call numpy.linalg.norm with a and b where a and b are numpy arrays.
Conclusion
To calculate the Euclidean distance with Python NumPy, we use the numpy.linalg.norm method.