If I have two arrays:
A=[1,2,3,4,5,6,7]
B=[2,4,7]
I would like to obtain an array C
that contains the indices of the the values of B
also found in A
C=[1,3,6]
I'm quite new to Python and I'm frustrated of not being able to find an elegant solution to such a simple task without the need of using a loop combined with numpy.where()
.
Thanks in advance!!