I'd need to iterate a process across values in two different columns:
A B Score Value
0 user1 test1 6.6 A
1 user1 test2 3.2 AA
2 user241 test1 4.8 B
3 user12 test4 3.1 C
4 user1 test1a 2.9 A
Specifically, I'd need to link
- user1 with test1, test2 and test1a
- user241 with test1
- user 12 with test4
...
in order to create a network. I tried as follows
from pymnet import *
import matplotlib.pyplot as plt
mnet = MultilayerNetwork(aspects=1)
for i in df['A']:
for j in df['B']:
mnet[i, j,'friendship','friendship'] = 1
fig=draw(mnet, show=True, figsize=(25,30))
But it seems to not link A and B as expected.
The problem is in the for
condition.
Can you help me to figure out how to run the for
loop correctly?