I am trying to add columns to a dataframe based on another row of the same dataframe. I would like to look up the row with the first column value equal to the value in column 5 and append columns 2, 3, and 4 to the dataframe as below
1 2 3 4 5
a b c d i
e f g h i
i j k l e
1 2 3 4 5 2a 3a 4a
a b c d i j k l
e f g h i j k l
i j k l e f g h
I have tried creating another table to merge df2 = df.loc[(df.1 == df.5)
in various combinations but no luck.