I have a Pandas DataFrame with the following structure
| left_id | right_id |
|---|---|
| a | b |
| c | a |
| x | y |
I need to transform this into a list of sets, like
[
{'a', 'b', 'c'},
{'x', 'y'}
]
the first two rows should be combined as a single set, because row 1 has id a and b and row 2 has ids c and a which, in this df, means the three IDs are related.
What is the right way to do this?