diff options
| author | Kenneth Reitz <me@kennethreitz.org> | 2017-08-28 01:06:43 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-08-28 01:06:43 -0400 |
| commit | ec54918f4a7303eba65e7575be52befed9c205c7 (patch) | |
| tree | 9c5e8cf1387a3f699bbdd08ef3987b04c27d3b41 /docs | |
| parent | ab6633549f2f2f331736f3f974483c0e39a451f2 (diff) | |
| download | tablib-ec54918f4a7303eba65e7575be52befed9c205c7.tar.gz | |
Update tutorial.rst
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/tutorial.rst | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/docs/tutorial.rst b/docs/tutorial.rst index 1a092e9..23d2773 100644 --- a/docs/tutorial.rst +++ b/docs/tutorial.rst @@ -115,33 +115,33 @@ Tablib's killer feature is the ability to export your :class:`Dataset` objects i **Comma-Separated Values** :: - >>> data.csv + >>> data.export('csv') Last Name,First Name,Age Reitz,Kenneth,22 Monke,Bessie,20 **JavaScript Object Notation** :: - >>> data.json + >>> data.export('json') [{"Last Name": "Reitz", "First Name": "Kenneth", "Age": 22}, {"Last Name": "Monke", "First Name": "Bessie", "Age": 20}] **YAML Ain't Markup Language** :: - >>> data.yaml + >>> data.export('yaml') - {Age: 22, First Name: Kenneth, Last Name: Reitz} - {Age: 20, First Name: Bessie, Last Name: Monke} **Microsoft Excel** :: - >>> data.xls + >>> data.export('xls') <censored binary data> **Pandas DataFrame** :: - >>> data.df + >>> data.export('df') First Name Last Name Age 0 Kenneth Reitz 22 1 Bessie Monke 21 @@ -224,7 +224,7 @@ Let's add a dynamic column to our :class:`Dataset` object. In this example, we h Let's have a look at our data. :: - >>> data.yaml + >>> data.export('yaml') - {Age: 22, First Name: Kenneth, Grade: 0.6, Last Name: Reitz} - {Age: 20, First Name: Bessie, Grade: 0.75, Last Name: Monke} @@ -254,7 +254,7 @@ For example, we can use the data available in the row to guess the gender of a s Adding this function to our dataset as a dynamic column would result in: :: - >>> data.yaml + >>> data.export('yaml') - {Age: 22, First Name: Kenneth, Gender: Male, Last Name: Reitz} - {Age: 20, First Name: Bessie, Gender: Female, Last Name: Monke} @@ -354,7 +354,7 @@ When, it's often useful to create a blank row containing information on the upco # Write spreadsheet to disk with open('grades.xls', 'wb') as f: - f.write(tests.xls) + f.write(tests.export('xls')) The resulting **tests.xls** will have the following layout: |
