Use numpy.linalg.norm
:
dist = numpy.linalg.norm(a-b)
You can find the theory behind this in Introduction to Data Mining
This works because the Euclidean distance is the l2 norm, and the default value of the ord parameter in numpy.linalg.norm
is 2.
More Related Contents:
- Minimum Euclidean distance between points in two different Numpy arrays, not within
- Efficiently Calculating a Euclidean Distance Matrix Using Numpy
- Find nearest value in numpy array
- NumPy array is not JSON serializable
- Index a 2D Numpy array with 2 lists of indices
- How to check if a value is in the list in selection from pandas data frame?
- shuffling/permutating a DataFrame in pandas
- SQL-like window functions in PANDAS: Row Numbering in Python Pandas Dataframe
- How do you stop numpy from multithreading? [duplicate]
- What techniques can be used to measure performance of pandas/numpy solutions
- numpy: efficiently summing with index arrays
- Python Numpy TypeError: ufunc ‘isfinite’ not supported for the input types
- What is the inverse of the numpy cumsum function?
- TensorFlow ValueError: Cannot feed value of shape (64, 64, 3) for Tensor u’Placeholder:0′, which has shape ‘(?, 64, 64, 3)’
- Find index where elements change value numpy
- Subtracting numpy arrays of different shape efficiently
- Why is np.where faster than pd.apply
- 2d convolution using python and numpy
- save numpy array in append mode
- Converting a 2D numpy array to a structured array
- Numpy sub-array assignment with advanced, mixed indexing
- Numpy difference between neighboring elements
- new pythonic style for shared axes square subplots in matplotlib?
- Understanding NumPy’s Convolve
- How can I serialize a numpy array while preserving matrix dimensions?
- Concatenate two numpy arrays in the 4th dimension
- How to get unix timestamp from numpy.datetime64
- Installing NumPy via Anaconda in Windows
- Remove consecutive duplicates in a NumPy array
- Convert list of lists with different lengths to a numpy array [duplicate]