I've got a numpy array, and would like to get the value at a specific element. For example, I might like to access the value at [1,1]
import numpy as np
A = np.arange(9).reshape(3,3)
print A[1,1]
# 4
Now, say I've got the coordinates in an array:
i = np.array([1,1])
How can I index A with my i coordinate array. The following doesn't work:
print A[i]
# [[3 4 5]
# [3 4 5]]
A[tuple(i)]will work.