I feel silly, because this is such a simple thing, but I haven\'t found the answer either here or anywhere else.
Is there no straightforward way of indexing a numpy
Just use a tuple:
>>> A[(3, 1)]
8
>>> A[tuple(ind)]
8
The A[]
actually calls the special method __getitem__
:
>>> A.__getitem__((3, 1))
8
and using a comma creates a tuple:
>>> 3, 1
(3, 1)
Putting these two basic Python principles together solves your problem.
You can store your index in a tuple in the first place, if you don't need NumPy array features for it.