Hi I would like to calculate euclidean distances between all points with X,Y coordinates in a dataframe and return the ID(the index) of the closest point.
currently I am using this to create a distance matrix:
diatancematrix=squareform(pdist(group))
df=pd.DataFrame(dists)
followed by this to return the minimum point:
closest=df.idxmin()
I dont seem to be able to retain the correct ID/index in the first step as it seems to assign column and row numbers from 0 onwards instead of using the index. is there a way to keep the correct index here?