I got data with columns: startpoint, endpoint, data.
I want to merge the startpoint, endpoint rows if they contain the same data (to both directions) and add another columns of the extra data.
for example starting with:
| startpoint | endpoint | data |
|---|---|---|
| A | B | 1 |
| C | D | 2 |
| B | A | 3 |
| D | C | 4 |
TO:
| startpoint | endpoint | data_1 | data_2 |
|---|---|---|---|
| A | B | 1 | 3 |
| C | D | 2 | 4 |
Is there quick way to do it on pandas?
Thanks.