0

so let's say that I have two dataframes, df1 - which contains more columns, but only column A is relevant in this question:

   A
  a1
  a2
  a3
  a4

and so on and so on. In the second dataframe, df2, column A contains exactly the same records as the column A in df1, however they are shuffled:

   A   B
   a3  2
   a1  5
   a4  3
   a2  4

and so on. The way they're shuffled isn't known. Now what I want to do is to get a dataframe, which would be somehow "merged" in a way that, keeping the order from df1, match the values of the second dataframe. So basing on the above examples the output would be:

   A   B 
   a1  5
   a2  4
   a3  2
   a4  3

The values in column "A" are not easily "orderable". How can I achieve such a frame? Thanks in advance!

Jakub Sapko
  • 138
  • 9

0 Answers0