【发布时间】:2020-09-26 22:36:17
【问题描述】:
我有以下数据框:
data = [['tom', 'matt','alex',10,1,'a'], ['adam', 'matt','james',15,1,'a'],['tom', 'adam','alex',20,1,'a'],['alex', 'matt','james',12,1,'a']]
# Create the pandas DataFrame
df = pd.DataFrame(data, columns = ['Person1','Person2','Person3', 'Attempts','Score','Category'])
print(df)
Person1 Person2 Person3 Attempts Score Category
0 tom matt alex 10 1 a
1 adam matt james 15 1 a
2 tom adam alex 20 1 a
3 alex matt james 12 1 a
我希望创建一个网络图,其中:
a) 在Person1, Person2, Person3 中,每个独特的人都有一个node
b)
nodesize 是每个人 Attempts 的总和
c) 在每个人之间有一个edge,他们共享一个Attempts,厚度是他们共享的“尝试次数”的总和。
我已通读文档,但仍在努力找出如何设置我的数据框然后进行绘图。关于如何做到这一点的任何想法?非常感谢!
【问题讨论】: