Skip to content

Commit 60822e9

Browse files
mcocdawcjreback
authored andcommitted
Added WhatsNew + Docstrings to_latex to_string
1 parent 82a9e3e commit 60822e9

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

doc/source/whatsnew/v0.20.0.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ Other enhancements
230230
- ``pd.TimedeltaIndex`` now has a custom datetick formatter specifically designed for nanosecond level precision (:issue:`8711`)
231231
- ``pd.types.concat.union_categoricals`` gained the ``ignore_ordered`` argument to allow ignoring the ordered attribute of unioned categoricals (:issue:`13410`). See the :ref:`categorical union docs <categorical.union>` for more information.
232232
- ``pandas.io.json.json_normalize()`` with an empty ``list`` will return an empty ``DataFrame`` (:issue:`15534`)
233+
- ``pd.DataFrame.to_latex`` and ``pd.DataFrame.to_string`` now allow optional header aliases. (:issue:`15536`)
233234

234235
.. _ISO 8601 duration: https://en.wikipedia.org/wiki/ISO_8601#Durations
235236

pandas/core/frame.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1529,6 +1529,8 @@ def to_feather(self, fname):
15291529
from pandas.io.feather_format import to_feather
15301530
to_feather(self, fname)
15311531

1532+
@Substitution('Write out column names. If a list of string is given, \
1533+
it is assumed to be aliases for the column names')
15321534
@Appender(fmt.docstring_to_string, indents=1)
15331535
def to_string(self, buf=None, columns=None, col_space=None, header=True,
15341536
index=True, na_rep='NaN', formatters=None, float_format=None,
@@ -1556,6 +1558,7 @@ def to_string(self, buf=None, columns=None, col_space=None, header=True,
15561558
result = formatter.buf.getvalue()
15571559
return result
15581560

1561+
@Substitution('whether to print column labels, default True')
15591562
@Appender(fmt.docstring_to_string, indents=1)
15601563
def to_html(self, buf=None, columns=None, col_space=None, header=True,
15611564
index=True, na_rep='NaN', formatters=None, float_format=None,
@@ -1609,6 +1612,8 @@ def to_html(self, buf=None, columns=None, col_space=None, header=True,
16091612
if buf is None:
16101613
return formatter.buf.getvalue()
16111614

1615+
@Substitution('Write out column names. If a list of string is given, \
1616+
it is assumed to be aliases for the column names.')
16121617
@Appender(fmt.common_docstring + fmt.return_docstring, indents=1)
16131618
def to_latex(self, buf=None, columns=None, col_space=None, header=True,
16141619
index=True, na_rep='NaN', formatters=None, float_format=None,

pandas/formats/format.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
col_space : int, optional
5454
the minimum width of each column
5555
header : bool, optional
56-
whether to print column labels, default True
56+
%s
5757
index : bool, optional
5858
whether to print index (row) labels, default True
5959
na_rep : string, optional

0 commit comments

Comments
 (0)