accessing an element in a numpy matrix using a list (python)
I ended up finding a solution.
storing the indices as tuples inside of a list works
indices = [(2,3), (3,4)] and then matrix[indices[0]] gives the desired output
I have a 10x10 numpy matrix and I have a list containing indices of elements I want to query.
matrix = np.zeros((10, 10), dtype=int)
indices = [[2,3], [3,4]]
the issue I'm facing is, what I actually want is the element matrix[2,3] but matrix[indices[0]] gives a different output because the latter actually means matrix[[2,3]]. the output is 2 different rows.
How do I get around this problem?