I need to take a list I have created and find the closest two points and print them out. How can I go about comparing each point in the list?
There isn\'t any need to pl
I realize that there are library constraints on this question, but for completeness if you have N
points in an Nx2 numpy ndarray (2D system):
from scipy.spatial.distance import pdist
x = numpy.array([[9.5,7.5],[10.2,19.1],[9.7,10.2]])
mindist = numpy.min(pdist(x))
I always try to encourage people to use numpy/scipy if they are dealing with data that is best stored in a numerical array and it's good to know that the tools are out there for future reference.