diff options
| author | Claude Paroz <claude@2xlibre.net> | 2019-11-06 21:37:01 +0100 |
|---|---|---|
| committer | Hugo van Kemenade <hugovk@users.noreply.github.com> | 2019-11-06 22:37:01 +0200 |
| commit | a9d9671b7f58341348d2ff3c1feb46c1fd2acd90 (patch) | |
| tree | 30c5b0315e107ae3afb15593a05b5762c5be016d /src | |
| parent | f1046cd13ee5d7ab93b1bf31fdc2cb2a6fcd3d9a (diff) | |
| download | tablib-a9d9671b7f58341348d2ff3c1feb46c1fd2acd90.tar.gz | |
Moved format documentation from code to docs (#420)
Diffstat (limited to 'src')
| -rw-r--r-- | src/tablib/core.py | 193 |
1 files changed, 0 insertions, 193 deletions
diff --git a/src/tablib/core.py b/src/tablib/core.py index a5ea0b0..d17e1e8 100644 --- a/src/tablib/core.py +++ b/src/tablib/core.py @@ -424,199 +424,6 @@ class Dataset: return fmt.export_set(self, **kwargs) - # ------- - # Formats - # ------- - - @property - def xls(): - """A Legacy Excel Spreadsheet representation of the :class:`Dataset` object, with :ref:`separators`. Cannot be set. - - .. note:: - - XLS files are limited to a maximum of 65,000 rows. Use :class:`Dataset.xlsx` to avoid this limitation. - - .. admonition:: Binary Warning - - :class:`Dataset.xls` contains binary data, so make sure to write in binary mode:: - - with open('output.xls', 'wb') as f: - f.write(data.xls) - """ - pass - - @property - def xlsx(): - """An Excel '07+ Spreadsheet representation of the :class:`Dataset` object, with :ref:`separators`. Cannot be set. - - .. admonition:: Binary Warning - - :class:`Dataset.xlsx` contains binary data, so make sure to write in binary mode:: - - with open('output.xlsx', 'wb') as f: - f.write(data.xlsx) - """ - pass - - @property - def ods(): - """An OpenDocument Spreadsheet representation of the :class:`Dataset` object, with :ref:`separators`. Cannot be set. - - .. admonition:: Binary Warning - - :class:`Dataset.ods` contains binary data, so make sure to write in binary mode:: - - with open('output.ods', 'wb') as f: - f.write(data.ods) - """ - pass - - @property - def csv(): - """A CSV representation of the :class:`Dataset` object. The top row will contain - headers, if they have been set. Otherwise, the top row will contain - the first row of the dataset. - - A dataset object can also be imported by setting the :class:`Dataset.csv` attribute. :: - - data = tablib.Dataset() - data.csv = 'age, first_name, last_name\\n90, John, Adams' - - Import assumes (for now) that headers exist. - - .. admonition:: Binary Warning for Python 2 - - :class:`Dataset.csv` uses \\r\\n line endings by default so, in Python 2, make - sure to write in binary mode:: - - with open('output.csv', 'wb') as f: - f.write(data.csv) - - If you do not do this, and you export the file on Windows, your - CSV file will open in Excel with a blank line between each row. - - .. admonition:: Line endings for Python 3 - - :class:`Dataset.csv` uses \\r\\n line endings by default so, in Python 3, make - sure to include newline='' otherwise you will get a blank line between each row - when you open the file in Excel:: - - with open('output.csv', 'w', newline='') as f: - f.write(data.csv) - - If you do not do this, and you export the file on Windows, your - CSV file will open in Excel with a blank line between each row. - """ - pass - - @property - def tsv(): - """A TSV representation of the :class:`Dataset` object. The top row will contain - headers, if they have been set. Otherwise, the top row will contain - the first row of the dataset. - - A dataset object can also be imported by setting the :class:`Dataset.tsv` attribute. :: - - data = tablib.Dataset() - data.tsv = 'age\tfirst_name\tlast_name\\n90\tJohn\tAdams' - - Import assumes (for now) that headers exist. - """ - pass - - @property - def yaml(): - """A YAML representation of the :class:`Dataset` object. If headers have been - set, a YAML list of objects will be returned. If no headers have - been set, a YAML list of lists (rows) will be returned instead. - - A dataset object can also be imported by setting the :class:`Dataset.yaml` attribute: :: - - data = tablib.Dataset() - data.yaml = '- {age: 90, first_name: John, last_name: Adams}' - - Import assumes (for now) that headers exist. - """ - pass - - @property - def df(): - """A DataFrame representation of the :class:`Dataset` object. - - A dataset object can also be imported by setting the :class:`Dataset.df` attribute: :: - - data = tablib.Dataset() - data.df = DataFrame(np.random.randn(6,4)) - - Import assumes (for now) that headers exist. - """ - pass - - @property - def json(): - """A JSON representation of the :class:`Dataset` object. If headers have been - set, a JSON list of objects will be returned. If no headers have - been set, a JSON list of lists (rows) will be returned instead. - - A dataset object can also be imported by setting the :class:`Dataset.json` attribute: :: - - data = tablib.Dataset() - data.json = '[{"age": 90, "first_name": "John", "last_name": "Adams"}]' - - Import assumes (for now) that headers exist. - """ - pass - - @property - def html(): - """A HTML table representation of the :class:`Dataset` object. If - headers have been set, they will be used as table headers. - - .. notice:: This method can be used for export only. - """ - pass - - @property - def dbf(): - """A dBASE representation of the :class:`Dataset` object. - - A dataset object can also be imported by setting the - :class:`Dataset.dbf` attribute. :: - - # To import data from an existing DBF file: - data = tablib.Dataset() - data.dbf = open('existing_table.dbf', mode='rb').read() - - # to import data from an ASCII-encoded bytestring: - data = tablib.Dataset() - data.dbf = '<bytestring of tabular data>' - - .. admonition:: Binary Warning - - :class:`Dataset.dbf` contains binary data, so make sure to write in binary mode:: - - with open('output.dbf', 'wb') as f: - f.write(data.dbf) - """ - pass - - @property - def latex(): - """A LaTeX booktabs representation of the :class:`Dataset` object. If a - title has been set, it will be exported as the table caption. - - .. note:: This method can be used for export only. - """ - pass - - @property - def jira(): - """A Jira table representation of the :class:`Dataset` object. - - .. note:: This method can be used for export only. - """ - pass - # ---- # Rows # ---- |
