繁体   English   中英

尝试将数据集加载为Snap.py中的表时出现运行时错误

[英]Runtime error while trying to load a dataset as a table in Snap.py

我试图从http://people.sc.fsu.edu/~jburkardt/datasets/cities/cities.html加载co04_dist.txt作为Snap.py中的表

import snap

context = snap.TTableContext()
filename = "co04_dist.txt"

schema = snap.Schema()
schema.Add(snap.TStrTAttrPr("Col1", snap.atInt))
schema.Add(snap.TStrTAttrPr("Col2", snap.atInt))
schema.Add(snap.TStrTAttrPr("Col3", snap.atInt))
schema.Add(snap.TStrTAttrPr("Col4", snap.atInt))

table = snap.TTable.LoadSS(schema, filename, context, "\t", snap.TBool(False))

但是我得到的只是运行时错误,声称应用程序以异常的方式请求运行时终止它。 它还在外壳中这样说:

Traceback (most recent call last):
  File "C:\Users\User\Documents\city.py", line 12, in <module>
table = snap.TTable.LoadSS(schema, filename, context, "\t", snap.TBool(False))
  File "C:\Python27\lib\snap.py", line 23070, in LoadSS
return _snap.TTable_LoadSS(*args)
RuntimeError: Execution stopped: Ss.GetFlds() == S.Len(), file c:\cygwin\home\rok\build\snap\snap-core\table.cpp, line 683

我已经确保txt文件已经与.py文件位于同一目录中。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM