Starting from this simple dataframe:
node t1 t2
0 a pos neg
1 b neg neg
2 c neg neg
3 d pos neg
4 e neg pos
5 f pos neg
6 g neg pos
I would like to build an edgelist file to read it as a undirected network. The expected output is:
b c
a d
a f
d f
e g
So basically I'm linking two nodes if they have the same pair of values in the ['t1','t2'] columns. So far I tried first to group the values into one new column:
d['c'] = [tuple(i) for i in df[['t1','t2']].values]
But then I'm stucked in grouping the users as I wish.
EDIT: fix error in the creation of the new column.