I have a Pandas dataframe that looks as follows:
name1 country1 name2 country2
A GER B USA
C GER E GER
D GER Y AUS
E GER A USA
I want to get a new dataframe with two columns name
and country
that contains the unique pairs of (name1, country1)
and (name2,country2)
.
The expected result should look like this:
name country
A GER
C GER
D GER
E GER
B USA
A USA
Y AUS
I have found something similar for single columns here. However, I do not know how to transform this solution to my problem, that is, pairs of columns.