Add docstrings to table to_format methods

pull/2/head
Vinayak Mehta 2018-09-09 18:41:40 +05:30
parent fcef880e6c
commit 1b013178a8
1 changed files with 12 additions and 0 deletions

View File

@ -321,6 +321,9 @@ class Table(object):
def to_csv(self, path, **kwargs): def to_csv(self, path, **kwargs):
"""Write Table to a comma-separated values (csv) file. """Write Table to a comma-separated values (csv) file.
Check `pandas.DataFrame.to_csv <https://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.to_csv.html>`_
kwargs for more details around what kwargs to use.
""" """
kw = { kw = {
'encoding': 'utf-8', 'encoding': 'utf-8',
@ -332,6 +335,9 @@ class Table(object):
def to_json(self, path, **kwargs): def to_json(self, path, **kwargs):
"""Write Table to a JSON file. """Write Table to a JSON file.
Check `pandas.DataFrame.to_json <https://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.to_json.html>`_
kwargs for more details around what kwargs to use.
""" """
kw = { kw = {
'orient': 'records' 'orient': 'records'
@ -343,6 +349,9 @@ class Table(object):
def to_excel(self, path, **kwargs): def to_excel(self, path, **kwargs):
"""Write Table to an Excel file. """Write Table to an Excel file.
Check `pandas.DataFrame.to_excel <https://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.to_excel.html>`_
kwargs for more details around what kwargs to use.
""" """
kw = { kw = {
'sheet_name': 'page-{}-table-{}'.format(self.page, self.order), 'sheet_name': 'page-{}-table-{}'.format(self.page, self.order),
@ -355,6 +364,9 @@ class Table(object):
def to_html(self, path, **kwargs): def to_html(self, path, **kwargs):
"""Write Table to an HTML file. """Write Table to an HTML file.
Check `pandas.DataFrame.to_html <https://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.to_html.html>`_
kwargs for more details around what kwargs to use.
""" """
html_string = self.df.to_html(**kwargs) html_string = self.df.to_html(**kwargs)
with open(path, 'w') as f: with open(path, 'w') as f: