Determine the shuffled indices of two lists/arrays

后端 未结 6 596
野的像风
野的像风 2021-01-18 16:03

As a challenge, I\'ve given myself this problem:

Given 2 lists, A, and B, where B is a shuffled version of A, the idea is to figure out the shuffled indices.

6条回答
  •  孤街浪徒
    2021-01-18 16:23

    LOL

    pd.Series(A).reset_index().set_index(0).ix[B].T.values[0]
    #array([2, 3, 0, 1])
    

提交回复
热议问题