I have a sample dataframe that looks like below. I'd like to eventually group row 1 and row 3 together, since they contain identical items in different columns.
x y count
a,b b,a 5
a,c c,a 2
b,a a,b 1
I've spent a lot of time trying to solve this, but have not encountered a good solution yet. What steps should I take to reach the below final dataframe?
x y count
a,b b,a 5+1
a,c c,a 2