0

Let's assume I have following numpy arrays:

idx = [1,2]
A   = [[1,2,3],
       [4,5,6],
       [7,8,9]]

I want to get A[idx[0],idx[1]]

A[idx] gets a slice. And I don't want to use A[idx[0],idx[1]] for clarity reasons

1 Answer 1

2

I have found a solution:

A[tuple(indx)]
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.