simpletableWrapper around pytables/hd5f to simplify using structured data | |
Download |
simpletable Ranking & Summary
Advertisement
- License:
- BSD License
- Price:
- FREE
- Publisher Name:
- Brent Pedersen
- Publisher web site:
- http://code.google.com/u/bpederse/
simpletable Tags
simpletable Description
Wrapper around pytables/hd5f to simplify using structured data simpletable is a Python library that removes some of the boiler-plate code required to use the excellent pytables module to save and access structured data.Example Usage:>>> from simpletable import SimpleTable>>> import tablesdefine a table as a subclass of simple table. >>> class ATable(SimpleTable): ... x = tables.Float32Col() ... y = tables.Float32Col() ... name = tables.StringCol(16)instantiate with: args: filename, tablename >>> tbl = ATable('test_docs.h5', 'atable1')insert as with pytables: >>> row = tbl.row >>> for i in range(50): ... row, row = i, i * 10 ... row = "name_%i" % i ... row.append() >>> tbl.flush()there is also insert_many() method with takes an iterable of dicts with keys matching the colunns (x, y, name) in this case.query the data (query() alias of tables' readWhere() >>> tbl.query('(x > 4) & (y < 70)') #doctest: +NORMALIZE_WHITESPACE array(, dtype=[('name', '|S16'), ('x', ' Requirements: · Python
simpletable Related Software