0
我想按照列排序pytable,然后用itersorted反向迭代使用负步骤。根据文档这是可能的:反向迭代pytable用itersorted和负步骤产生OverflowError
OverflowError:不能负的值转换为无符号PY_LONG_LONG
http://pytables.github.io/usersguide/libref.html?highlight=itersorted#tables.Table.itersorted
但是,我得到的,当我用步= -1以下错误
如果步骤是肯定的,则错误不会发生。 我已经用pytables 2.4和3.0.0b1试过了,两者都有同样的问题。
任何想法为什么会发生这种情况?这是一个错误?我需要做点别的吗?
我附上最低工作例如:
import tables
class IndexRecord(tables.IsDescription):
frame = tables.Int32Col(pos=1)
key = tables.StringCol(itemsize=40, pos=2)
h5 = tables.openFile("trace.h5", 'w')
index = h5.createTable(h5.root, "index", IndexRecord)
index.append([(0, 'A')])
index.append([(1, 'B')])
index.append([(3, 'C')])
index.append([(4, 'D')])
index.flush()
index.cols._f_col('frame').createCSIndex()
for row in index.itersorted('frame', step=-1): #<-crashes here!
print row['frame'], row['key']
好,谢谢。最后,我使用itersequence解决了我的问题,并创建了一个我想要访问的行的序列,非常灵活。 – martinako 2013-05-12 12:21:31