This is a small part of a df.
In this case, I have 3 y-values I need to map: 0.933883, 97.658330 and 1.650013
I have this df
x y1 y2 y3 y4 d1 d2 d3 d4
23 5.3 NaN NaN 0.933883 NaN NaN NaN 0.174866 NaN
25 5.3 NaN NaN NaN 97.658330 NaN NaN NaN 0.038670
26 5.3 NaN NaN 1.650013 NaN NaN NaN 0.541264 NaN
29 5.3 NaN NaN 97.658330 NaN NaN NaN 96.549581 NaN
30 5.3 NaN NaN NaN 1.650013 NaN NaN NaN 96.046987
There is not more than one of these values per column, I already dropped duplicates.
What I need:
I can not have the same value in more than one column.
The condition to choose which row to remove is as shown in this example:
There is 97.658330 in column y3 and y4. Since, for that value, d3(96.549581) is bigger than d4(0.038670), row 29 is removed.
There is 1.650013 in column y3 and y4. Since d4(96.046987) is bigger than d3(0.541264), row 30 is removed.
Output:
x y1 y2 y3 y4 d1 d2 d3 d4
23 5.3 NaN NaN 0.933883 NaN NaN NaN 0.174866 NaN
25 5.3 NaN NaN NaN 97.658330 NaN NaN NaN 0.038670
26 5.3 NaN NaN 1.650013 NaN NaN NaN 0.541264 NaN
P.S. There are a lot more values to map inside the complete data frame.