Datetime as a dimension in python KDTree

There is currently a working example using scipy.spatial.KDTree to make the closest neighbor to search for some x, y points.

Question: if I have datetime data for each point x, y, can I put this in KDTree and change my spatial search for the nearest neighbor to perform the nearest space-time search for neighbors?

Search for nearest spatial neighbors with:

pts = np.array([[1, 50], [1.89, 52.4]])

print tree.query(pts, k=5)

+4
source share

Source: https://habr.com/ru/post/1496035/


All Articles