diff options
| author | Jean Jordaan <jean.jordaan@gmail.com> | 2019-03-03 13:29:21 +0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-03-03 13:29:21 +0700 |
| commit | addaa090efb4d4beacb2bd2cc6dbdb7e158fa2a9 (patch) | |
| tree | de3b532ed49a0d1e8a2e333b549b129d534bff91 /README.rst | |
| parent | cd67a63b434c33430d8fd32d6d15027b42811d9d (diff) | |
| parent | 79dc77de49b8375d616a6cabb4503feb990bb51d (diff) | |
| download | tablib-addaa090efb4d4beacb2bd2cc6dbdb7e158fa2a9.tar.gz | |
Merge branch 'master' into master
Diffstat (limited to 'README.rst')
| -rw-r--r-- | README.rst | 67 |
1 files changed, 40 insertions, 27 deletions
@@ -21,14 +21,18 @@ Output formats supported: - Excel (Sets + Books) - JSON (Sets + Books) - YAML (Sets + Books) +- Pandas DataFrames (Sets) - HTML (Sets) +- Jira (Sets) - TSV (Sets) -- OSD (Sets) +- ODS (Sets) - CSV (Sets) - DBF (Sets) Note that tablib *purposefully* excludes XML support. It always will. (Note: This is a joke. Pull requests are welcome.) +If you're interested in financially supporting Kenneth Reitz open source, consider `visiting this link <https://cash.me/$KennethReitz>`_. Your support helps tremendously with sustainability of motivation, as Open Source is no longer part of my day job. + Overview -------- @@ -71,13 +75,13 @@ Intelligently add new columns: :: Slice rows: :: - >>> print data[:2] + >>> print(data[:2]) [('John', 'Adams', 90), ('George', 'Washington', 67)] Slice columns by header: :: - >>> print data['first_name'] + >>> print(data['first_name']) ['John', 'George', 'Henry'] Easily delete rows: :: @@ -93,51 +97,60 @@ JSON! +++++ :: - >>> print data.json - [ - { - "last_name": "Adams", - "age": 90, - "first_name": "John" - }, - { - "last_name": "Ford", - "age": 83, - "first_name": "Henry" - } - ] + >>> print(data.export('json')) + [ + { + "last_name": "Adams", + "age": 90, + "first_name": "John" + }, + { + "last_name": "Ford", + "age": 83, + "first_name": "Henry" + } + ] YAML! +++++ :: - >>> print data.yaml - - {age: 90, first_name: John, last_name: Adams} - - {age: 83, first_name: Henry, last_name: Ford} + >>> print(data.export('yaml')) + - {age: 90, first_name: John, last_name: Adams} + - {age: 83, first_name: Henry, last_name: Ford} CSV... ++++++ :: - >>> print data.csv - first_name,last_name,age - John,Adams,90 - Henry,Ford,83 + >>> print(data.export('csv')) + first_name,last_name,age + John,Adams,90 + Henry,Ford,83 EXCEL! ++++++ :: - >>> with open('people.xls', 'wb') as f: - ... f.write(data.xls) + >>> with open('people.xls', 'wb') as f: + ... f.write(data.export('xls')) DBF! ++++ :: >>> with open('people.dbf', 'wb') as f: - ... f.write(data.dbf) + ... f.write(data.export('dbf')) + +Pandas DataFrame! ++++++++++++++++++ +:: + + >>> print(data.export('df')): + first_name last_name age + 0 John Adams 90 + 1 Henry Ford 83 It's that easy. @@ -147,7 +160,7 @@ Installation To install tablib, simply: :: - $ pip install tablib + $ pip install tablib[pandas] Make sure to check out `Tablib on PyPi <https://pypi.python.org/pypi/tablib/>`_! |
