Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import tables
- class Test(tables.IsDescription):
- word1 = tables.StringCol(50, pos=0)
- word2 = tables.StringCol(50, pos=1)
- weight = tables.Int32Col(pos=2)
- h5file = tables.openFile('derp.h5', mode='w')
- table = h5file.createTable(h5file.root, 'derp_table', Test, 'derp')
- r = table.row
- words = [("hello", "salut"), ("numa", "yay"), ("full", "open")]
- for w in words:
- r['word1'] = w[0]
- r['word2'] = w[1]
- r['weight'] = 0
- r.append()
- table.flush()
- results_query1 = [r.nrow for r in table.where('word1 == "hello"')]
- print table.readCoordinates(results_query1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement