0

列に従って 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']
4

1 に答える 1

0

これはバグです。今、報告しています。

編集: [1] にこの問題の修正があります。うまくいけば、それは 3.0 リリースに組み込まれるでしょう。今後、[2] または pytables-users@lists.sourceforge.net でバグを報告してください。

  1. https://github.com/PyTables/PyTables/pull/253
  2. https://github.com/PyTables/PyTables/issues
于 2013-05-11T19:27:48.047 に答える