Is there a numpy-thonic way, e.g. function, to find the nearest value in an array?
Example:
np.find_nearest( array, value )
Is there a numpy-thonic way, e.g. function, to find the nearest value in an array?
Example:
np.find_nearest( array, value )
If you don't want to use numpy this will do it:
I think the most pythonic way would be:
This is the basic code. You can use it as a function if you want