summaryrefslogtreecommitdiff
path: root/tablib/core.py
diff options
context:
space:
mode:
authorBruno Alla <alla.brunoo@gmail.com>2019-03-02 10:34:19 -0300
committerBruno Alla <alla.brunoo@gmail.com>2019-03-02 10:41:07 -0300
commitf757ab84d1436dff2c32b56fd2d4bbd08968f0c4 (patch)
treee5e81f6a378ed15cc004756f28412c97e067ec9c /tablib/core.py
parent80e72cfa27264efb9f525bd92ce6476c5eadb3e9 (diff)
parentdc24fda41505d9961cd43939893a1cea3598ad18 (diff)
downloadtablib-f757ab84d1436dff2c32b56fd2d4bbd08968f0c4.tar.gz
Merge branch 'master' into bugfix/invalid-ascii-csv
# Conflicts: # setup.py # tablib/compat.py # test_tablib.py
Diffstat (limited to 'tablib/core.py')
-rw-r--r--tablib/core.py45
1 files changed, 38 insertions, 7 deletions
diff --git a/tablib/core.py b/tablib/core.py
index b97da54..78c4dce 100644
--- a/tablib/core.py
+++ b/tablib/core.py
@@ -9,20 +9,21 @@
:license: MIT, see LICENSE for more details.
"""
+from collections import OrderedDict
from copy import copy
from operator import itemgetter
from tablib import formats
-from tablib.compat import OrderedDict, unicode
+from tablib.compat import unicode
__title__ = 'tablib'
-__version__ = '0.11.4'
-__build__ = 0x001104
+__version__ = '0.12.1'
+__build__ = 0x001201
__author__ = 'Kenneth Reitz'
__license__ = 'MIT'
-__copyright__ = 'Copyright 2016 Kenneth Reitz'
+__copyright__ = 'Copyright 2017 Kenneth Reitz'
__docformat__ = 'restructuredtext'
@@ -526,9 +527,9 @@ class Dataset(object):
Import assumes (for now) that headers exist.
- .. admonition:: Binary Warning
+ .. admonition:: Binary Warning for Python 2
- :class:`Dataset.csv` uses \\r\\n line endings by default, so make
+ :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:
@@ -536,6 +537,18 @@ class Dataset(object):
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
@@ -570,6 +583,18 @@ class Dataset(object):
"""
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():
@@ -619,7 +644,6 @@ class Dataset(object):
"""
pass
-
@property
def latex():
"""A LaTeX booktabs representation of the :class:`Dataset` object. If a
@@ -629,6 +653,13 @@ class Dataset(object):
"""
pass
+ @property
+ def jira():
+ """A Jira table representation of the :class:`Dataset` object.
+
+ .. note:: This method can be used for export only.
+ """
+ pass
# ----
# Rows