INNER CODE UNIT · Python
euclidean_distance
TheAlgorithms/Jupyter · machine_learning/dbscan/dbscan.py:7
def euclidean_distance(q, p):
"""
Calculates the Euclidean distance
between points q and p
Distance can only be calculated between numeric values
>>> euclidean_distance([1,'a'],[1,2])
Traceback (most recent call last):
...
ValueError: Non-numeric input detected
The dimentions of both the points must be the same
>>> euclidean_distance([1,1,1],[1,2])
Traceback (most recent call last):
...
ValueError: expected dimensions to be 2-d, instead got p:3 and q:2
Supports only two dimentional points