human
numpy index of nearest value.
assistant
Here is a Python code to numpy the index of nearest value

import numpy as np

def _nearest_value_index(array, value):
    """
    Return the index of the nearest value in the array.
    """
    array = np.asarray(array)
    idx = (np.abs(array - value)).argmin()
    return idx

# Enter the array
array = np.array([1, 2, 3, 4, 5])

# Enter the value
value = 2.5

# Calling the function
print((_nearest_value_index(array, value)))

#Example Output
# 1

#Remember to inspect code for bugs.