Created
May 7, 2013 07:00
-
-
Save ihaque/5530731 to your computer and use it in GitHub Desktop.
Demo program for pytables bug
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tables | |
import numpy as np | |
h5 = tables.openFile('test.h5', 'w') | |
table = h5.createTable( | |
h5.root, 'table', | |
description=np.dtype([('col', 'S16')])) | |
table.append([('S_%05d' % i,) for i in xrange(10)]) | |
print " ------- Unindexed ---------" | |
for xx in range(11): | |
table.where('col < "S_%05d"' % xx) | |
print (xx, | |
len(list(table.where('col < "S_%05d"' % xx))), | |
len(list(table.where('col == "S_%05d"' % xx))), | |
len(list(table.where('col <= "S_%05d"' % xx)))) | |
table.cols.col.createCSIndex() | |
print " -------- Indexed --------" | |
print " This should look the same as above" | |
for xx in range(11): | |
table.where('col < "S_%05d"' % xx) | |
print (xx, | |
len(list(table.where('col < "S_%05d"' % xx))), | |
len(list(table.where('col == "S_%05d"' % xx))), | |
len(list(table.where('col <= "S_%05d"' % xx)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment