I am using a lot of argmin and argmax in Python.
Unfortunately, the function is very slow.
I have done some searching around, and the best I can find is here
For those that came for a short numpy-free snippet that returns the index of the first minimum value:
def argmin(a): return min(range(len(a)), key=lambda x: a[x]) a = [6, 5, 4, 1, 1, 3, 2] argmin(a) # returns 3