Unpacking tuples/arrays/lists as indices for Numpy Arrays

It’s easier than you think:

>>> import numpy
>>> A = numpy.array(((1,2),(3,4)))
>>> idx = (0,0)
>>> A[idx]
1

Leave a Comment