Hi,

I need to create a construct that returns the index of entries of the first 
list, if values in the first and second list are equal.

Take
valA = [1,2,3,4,20,21,22,23,24]
valB = [1,2,3,4,  5,21,22,23]
The correct solution is: [0,1,2,3,5,6,7]

A potential loop can be:
takeList=[]
for j,a in enumerate(valA):
    if a in valB:
        takeList.append(j)


Please note, valA can have entries like [1,10000000,1000000001,.....], i.e. it 
can be very sparse.
I also thought about using bincount, but due to the sparse nature the return 
values from bincount would allocate too much memory.

Any idea how to do it fast using numpy?

Thanks,
Andreas

_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to