问题描述
希望有人可以提供帮助-我正在导入包含3列的csv,但是正如您在下面看到的那样,打印输出似乎具有第3列,因为它是自己的表?
from pyvis.network import Network
import pandas as pd
got_net = Network(notebook = True,height="750px",width="100%",bgcolor="#222222",font_color="white")
got_net.barnes_hut()
got_data = pd.read_csv('C://users/swood/usage.csv',index_col=False,dtype=None)
print(got_data.head())
client = got_data['name']
deployed_to = got_data['deployed']
weight = got_data['desktops']
edge_data = zip(client,deployed_to,weight) for e in edge_data:
src = e[0]
dst = e[1]
w = e[2]
got_net.add_node(src,src,title=src)
got_net.add_node(dst,dst,title=dst)
got_net.add_node(src,value=w)
relationship_map = got_net.get_adj_list() for node in got_net.nodes:
node["title"] += " Deployed_Desktops:<br>" + "<br>".join(relationship_map[node["id"]])
node["value"] = len(relationship_map[node["id"]])
got_net.show("usagedata.html")
产生
name deployed \
0 Abbey National Treasury services PLC 012 Smile Communications LTD.
1 Abbey National Treasury services PLC 013 NetVision Ltd
2 Abbey National Treasury services PLC A1 Telekom Austria AG
3 Abbey National Treasury services PLC Abacus Group LLC
4 Abbey National Treasury services PLC Abanka Vipa d.d.
desktops
0 2
1 3
2 1
3 9
4 2
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)