Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
simple Python function to find the index of an array, which corrosponding value is nearest to a given float
def find_nearest(array, value):
return (np.abs(array - value)).argmin()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.