Lets say I have a numpy array:
arr = np.array([1,2,3,4,9,11])
and I would like to find elements of a target array say:
target = np.array([3,10])
that are closest to the elements of the original array. So the the results is going to be:
[3,3,3,3,10,10]
Because 1,2,3,4 are matched to 3 of the target array and 9,11 were matched to 10.
Is there a function in scipy/numpy to do that?