I have a df as below
A B C D R S T U
44.562 42.975 39.252 40.973 37.994 39.191 38.69 40.973
42.621 40.79 40.741 40.887 40.863 40.204 40.131 40.887
38.751 39.301 43.756 40.68 38.397 39.301 42.133 38.788
44.562 41.229 43.2 41.59 43.561 41.01 43.2 41.486
40.472 41.278 43.951 41.99 42.55 41.083 42.572 40.472
In each of these rows, there is a duplicate value.
Columns A,B,C & D are a group & columns R,S,T & U are a family.
What I am trying to do is find the column in group R,S,T & U which are same value as one of the column from A,B,C & D and then get the value from the corresponding row in a new column res
Also, get value from a 'linked column' (A is linked to D & B is linked to C) in a new column res1
Expected Output
A B C D R S T U res res1
44.562 42.975 39.252 40.973 37.994 39.191 38.69 40.973 40.973 44.562
42.621 40.79 40.741 40.887 40.863 40.204 40.131 40.887 40.887 42.621
38.751 39.301 43.756 40.68 38.397 39.301 42.133 38.788 39.301 43.756
44.562 41.229 43.2 41.59 43.561 41.01 43.2 41.486 43.2 41.229
40.472 41.278 43.951 41.99 42.55 41.083 42.572 40.472 40.472 41.99