diff options
author | Kenneth Reitz <me@kennethreitz.com> | 2010-08-28 21:06:30 -0400 |
---|---|---|
committer | Kenneth Reitz <me@kennethreitz.com> | 2010-08-28 21:09:12 -0400 |
commit | ad0c7afa2247803fc4bc66c8a14ee1822a606100 (patch) | |
tree | e807fc06ebc600aa2bba574aa6b216746a728263 | |
parent | 5018fd70fca8cebcdcca7f8c2d1b13d01139f4b1 (diff) | |
download | tablib-ad0c7afa2247803fc4bc66c8a14ee1822a606100.tar.gz |
readme
-rw-r--r-- | README.rst | 101 |
1 files changed, 52 insertions, 49 deletions
@@ -1,12 +1,15 @@ -**Tabbed is under active documentation-driven development.** - +Tabbed: format-agnostic tabular dataset library +=============================================== :: - _____ ______ ______ _________ - __ /_______ ____ /_ ___ /_ _____ ______ / - _ __/_ __ `/__ __ \__ __ \_ _ \_ __ / - / /_ / /_/ / _ /_/ /_ /_/ // __// /_/ / - \__/ \__,_/ /_.___/ /_.___/ \___/ \__,_/ + + _____ ______ ______ _________ + __ /_______ ____ /_ ___ /_ _____ ______ / + _ __/_ __ `/__ __ \__ __ \_ _ \_ __ / + / /_ / /_/ / _ /_/ /_ /_/ // __// /_/ / + \__/ \__,_/ /_.___/ /_.___/ \___/ \__,_/ + +*Tabbed is under active documentation-driven development.* Tabbed is a format-agnostic tabular dataset library, written in Python. @@ -21,7 +24,7 @@ Formats supported: - CSV - HTML -Please note that tabbed _purposefully_ excludes XML support. It always will. +Please note that tabbed *purposefully* excludes XML support. It always will. Features @@ -29,66 +32,66 @@ Features Convert datafile formats via API: :: - tabbed.import(filename='data.csv').export('data.json') + tabbed.import(filename='data.csv').export('data.json') Convert datafile formats via CLI: :: - $ tabbed data.csv data.json - + $ tabbed data.csv data.json + Convert data formats via CLI pipe interface: :: - - $ curl http://domain.dev/dataset.json | tabbed --to excel | gist -p - - + + $ curl http://domain.dev/dataset.json | tabbed --to excel | gist -p + + Populate fresh data files: :: - - headers = ('first_name', 'last_name', 'gpa') + + headers = ('first_name', 'last_name', 'gpa') - data = [ - ('John', 'Adams', 4.0), - ('George', 'Washington', 2.6), - ('Henry', 'Ford', 2.3) - ] - - data = tabbed.Data(*data, headers=headers) + data = [ + ('John', 'Adams', 4.0), + ('George', 'Washington', 2.6), + ('Henry', 'Ford', 2.3) + ] + + data = tabbed.Data(*data, headers=headers) - # Establish file location and save - data.save('test.xls') - + # Establish file location and save + data.save('test.xls') + Intelligently add new rows: :: - data.addRow('Bob', 'Dylan') - # >>> Warning: Existing column count is 3 - - print data.headers - # >>> ('first_name', 'last_name', 'gpa') - + data.addRow('Bob', 'Dylan') + # >>> Warning: Existing column count is 3 + + print data.headers + # >>> ('first_name', 'last_name', 'gpa') + -Slice rows: :: +Slice rows: :: - print data[0:1] - # >>> [('John', 'Adams', 4.0), ('George', 'Washington', 2.6)] - + print data[0:1] + # >>> [('John', 'Adams', 4.0), ('George', 'Washington', 2.6)] + Slice columns by header: :: - print data['first_name'] - # >>> ['John', 'George', 'Henry'] - + print data['first_name'] + # >>> ['John', 'George', 'Henry'] + Manipulate rows by index: :: - data.delRow(0) - print data[0:1] - # >>> [('George', 'Washington', 2.6), ('Henry', 'Ford', 2.3)] - - # Update saved file - data.save() - + data.delRow(0) + print data[0:1] + # >>> [('George', 'Washington', 2.6), ('Henry', 'Ford', 2.3)] + + # Update saved file + data.save() + Export to various formats: :: - # Save copy as CSV - data.export('backup.csv')
\ No newline at end of file + # Save copy as CSV + data.export('backup.csv')
\ No newline at end of file |