Created
November 2, 2021 00:31
-
-
Save KrisYu/297ef9f8f1175fb7b77b2dc67c2a230f to your computer and use it in GitHub Desktop.
distance from one point to array of points
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://stackoverflow.com/questions/48609781/distance-between-one-point-and-rest-of-the-points-in-an-array/48610147 | |
from scipy.spatial import distance | |
X = [(35.0456, -85.2672)] | |
coords = [(35.1174, -89.9711), | |
(35.9728, -83.9422), | |
(36.1667, -86.7833)] | |
distance.cdist(X, coords, 'euclidean') | |
array([[ 4.70444794, 1.6171966 , 1.88558331]]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment