【发布时间】:2019-09-22 12:35:54
【问题描述】:
我有这个结构如下的 small-gephiready.tsv 文件:
Source Target Type
1 2 Undirected
1 3 Undirected
1 4 Undirected
1 5 Undirected
1 6 Undirected
我想在python环境下通过NetworkX打开它,代码:
G = nx.read_edgelist("small-gephiready.tsv", nodetype=int)
但是,它返回错误“无法将边缘数据 (['Type']) 转换为字典”。我以为Type datas是string,所以在nodetype=int后面加了data=('Type',str),返回str has no attribute decode。
是我写错了 read_edge 函数还是我必须在文件中签入一些东西?感谢您的帮助。
【问题讨论】:
标签: string networking graph networkx readfile