I have two dataframes that are exactly the same:
df1:
P1 ID
1 10
2 10
3 10
2 5
3 5
df2:
P2 ID
1 10
2 10
3 10
2 5
3 5
I want to merge them on ID, but I do not want to repeat the values of the P columns in the same row. That is I want the following result:
P1 ID P2
1 10 2
1 10 3
2 10 1
2 10 3
3 10 1
3 10 2
2 5 3
3 5 2
Is there a way to do this without doing regular merge and then removing rows with repeated values in P1 and P2?