Skip to content

Instantly share code, notes, and snippets.

@alep
Created February 21, 2017 20:09
Show Gist options
  • Save alep/603b41674dcb0b1fd5d2b752d386840d to your computer and use it in GitHub Desktop.
Save alep/603b41674dcb0b1fd5d2b752d386840d to your computer and use it in GitHub Desktop.
#python3
import numpy as np
from itertools import product
from scipy.spatial.distance import euclidean
coords = [(35.0456, -85.2672),
(35.1174, -89.9711),
(35.9728, -83.9422),
(36.1667, -86.7833)]
a = np.fromiter(map(lambda x: euclidean(x[0], x[1]), product(coords, repeat=2)), dtype=float)
a.resize(4,4)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment