If I have:
x = np.asarray([[1,2],[3,4],[5,6]])
And I would like to create:
y = np.asarray([1,4,5])
In order to do this, I built an array as follows:
inds = np.asarray([[0,0],[1,1],[2,0]])
And I passed it to x
as follows:
y = x[inds]
This does not yield the elements indexed by the rows in inds
. How do I achieve this functionality in either this fashion, or a fashion very similar to this?