import numpy as np
a = np.array([[10, -1], [3, 1], [5, -1], [7, 1]])
mask = a[:, (1)] == -1
arg = np.argmin(a[mask][:, (0)])
result = np.arange(a.shape[0])[mask][arg]
print(result)
Numpy: get index of smallest value based on conditions