Answer the question
In order to leave comments, you need to log in
How to find indexes of elements from one array in another?
There is an array numpy.array
a = [1,2,3]
there is an array numpy.array
b = [3,4,5,1,2]
We need to find the indices of elements from a to b , here it is [3, 4, 0]
Those. the operation is the reverse of taking an index on another array b[X] == a
Perhaps there is a way not to go through a in the Python loop using where each time, but to solve everything beautifully with one ready-made method?
All elements of a are guaranteed to occur exactly once in b.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question