Orginally I have a hashtag co-occ network stored in dataframe like this:
0 ['#A', '#B', '#C', '#D]
1 ['#A', '#E']
2 ['#b', '#c', '#D']
3 ['#C', '#D']
Then I converted it into an adjacency matrix like this:
,#A,#B,#C,#D,#E,#F,#G,#H,#I,#J,#K
#A,0,1,1,0,1,1,1,1,0,1,0
#B,1,0,0,0,1,1,1,1,0,1,0
#C,1,0,0,0,1,1,1,1,0,1,0
...
I want to load the net into networkx in order to do the math and draw the graph. So I use the np.genfromtext method to load the data into ndarrary. I have loaded the data successfully but I don't know how to label them.
mydata = genfromtxt(src5+fname[0], delimiter=',',encoding='utf-8',comments='**')
adjacency = mydata[1:,1:]
print(adjacency)
[[0. 0. 0. ... 0. 0. 0.]
[0. 0. 0. ... 0. 0. 0.]
[0. 0. 0. ... 0. 0. 0.]
...
[0. 0. 0. ... 0. 0. 0.]
[0. 0. 0. ... 0. 0. 0.]
[0. 0. 0. ... 0. 0. 0.]]
By the way, can I just input the data from the original dataframe instead of using the adjacency matrix?
