Skip to content

Commit 63e6000

Browse files
committed
BUG: fix to_latex bold_rows option (3)
1 parent 87ab246 commit 63e6000

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

doc/source/whatsnew/v0.20.3.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ Bug Fixes
4040

4141

4242

43-
4443
Conversion
4544
^^^^^^^^^^
4645

@@ -55,7 +54,8 @@ Indexing
5554
I/O
5655
^^^
5756

58-
-- Bug in ``pd.read_csv()`` in which files weren't opened as binary files by the C engine on Windows, causing EOF characters mid-field, which would fail (:issue:`16039`, :issue:`16559`, :issue`16675`)
57+
- Bug in ``pd.read_csv()`` in which files weren't opened as binary files by the C engine on Windows, causing EOF characters mid-field, which would fail (:issue:`16039`, :issue:`16559`, :issue`16675`)
58+
- Bug in ``.to_latex()`` where ``bold_rows`` was disregarded and always assumed to be False. This affected also the default behaviour with ``bold_rows`` omitted. (:issue:`16708`)
5959

6060
Plotting
6161
^^^^^^^^

pandas/io/formats/format.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -845,6 +845,7 @@ def __init__(self, formatter, column_format=None, longtable=False,
845845
multicolumn=False, multicolumn_format=None, multirow=False):
846846
self.fmt = formatter
847847
self.frame = self.fmt.frame
848+
self.bold_rows = self.fmt.kwds.get('bold_rows', False)
848849
self.column_format = column_format
849850
self.longtable = longtable
850851
self.multicolumn = multicolumn
@@ -943,7 +944,7 @@ def get_col_type(dtype):
943944
if x else '{}') for x in row]
944945
else:
945946
crow = [x if x else '{}' for x in row]
946-
if self.fmt.kwds.get('bold_rows', True) and self.fmt.index:
947+
if self.bold_rows and self.fmt.index:
947948
# bold row labels
948949
crow = ['\\textbf{%s}' % x
949950
if j < ilevels and x.strip() not in ['', '{}'] else x

0 commit comments

Comments
 (0)