How To Access Numpy Array With A Set Of Indices Stored In Another Numpy Array?
I have a numpy array which stores a set of indices I need to access another numpy array. I tried to use a for loop but it doesn't work as I expected. The situation is like this: &g
Solution 1:
Convert it to a tuple
:
>>>a[tuple(c[0])]
1
Because list
and array
indices trigger advanced indexing. tuple
s are (mostly) basic slicing.
Post a Comment for "How To Access Numpy Array With A Set Of Indices Stored In Another Numpy Array?"