2017-07-28 119 views
0
加载数据集作为一个表

我试图在Snap.py运行时错误,而试图在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)) 

http://people.sc.fsu.edu/~jburkardt/datasets/cities/cities.html加载co04_dist.txt作为一个表,但我得到的是运行时错误声称应用程序请求运行时以不寻常的方式终止它。它也说这在壳:

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文件相同的目录中。

回答