How do you get the lookup mapping of two lists?

Hi there,

I'm trying to find some way to map the order indexes of 2 lists with the same content, but whose elements are placed in different order.

Ok, unclear, let me explain:

I have a list with names, having original order indexes...

N1 = [ Frank, Carl, David, Boris, Elton, Andrew ]
O1 = [ 1, 2, 3, 4, 5, 6 ]

..and I re-arrange in alphabetical order, and get this:

N2 = [ Andrew, Boris, Carl, David, Elton, Frank ]

So far, so good; I have the working function for this job.

However, I can't see how could I get the rearranged indexes of the updated list, namely:

O2 = [ 6, 4 , 2 , 3 , 5 , 1 ]

In other words, I'm seeking for a function to retrieve the above 'O2' list, containing the indexes of the updated list, N2.

Do someone have any insight?

Maybe something like this..

3 Likes

Wow, exactly what I wanted.
Thank you very much.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.