from scipy import spatial
import numpy as np
A = np.random.random((10, 2)) * 100
A
pt = [6, 30]
A[spatial.KDTree(A).query(pt)[1]]
distance, index = spatial.KDTree(A).query(pt)
distance
index
A[index]
Finding index of nearest point in numpy arrays of x and y coordinates