列に従って pytable をソートし、負のステップを使用して itersorted で逆反復しようとしています。ドキュメントによると、これは可能です。
http://pytables.github.io/usersguide/libref.html?highlight=itersorted#tables.Table.itersorted
ただし、step=-1 を使用すると、次のエラーが発生します。
OverflowError: 負の値を符号なし PY_LONG_LONG に変換できません
step が正の場合、エラーは発生しません。私は 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']