Converting adjacency matrix into table with from/to/frequency

20 Views Asked by At

I have a situation like this one:

id a b c
a 0 0 0
b 0 0 3
c 0 11 2

The observations are frequencies of how many times a contacts b, ecc...

I need a dataframe like this one:

from to frequency
a b
a c
a a
b a
b c
b b
c a
c b
c c
0

There are 0 best solutions below