DataFrame.to_latex(): bold_rows option is disregarded · Issue #16707 · pandas-dev/pandas (original) (raw)

Code Sample, a copy-pastable example if possible

import pandas as pd df = pd.DataFrame({'acol':['a', 'aa'], 'bcol':['b', 'bb']}, index=['row1', 'row2']) print df.to_latex(bold_rows=True)

\begin{tabular}{lll}
\toprule
{} & acol & bcol \\
\midrule
row1 &    a &    b \\
row2 &   aa &   bb \\
\bottomrule
\end{tabular}

Problem description

Despite bold_rows is documented to be an option of to_latex() and to be True by default, in reality, this option has no effect. Moreover, the current behaviour corresponds with what would be expected for bold_rows=False and is thus in contrast with the documented default 'bold_rows=True' behaviour.

Expected Output

\begin{tabular}{lll}
\toprule
{} & acol & bcol \\
\midrule
\textbf{row1} &    a &    b \\
\textbf{row2} &   aa &   bb \\
\bottomrule
\end{tabular}

Output of pd.show_versions()

INSTALLED VERSIONS

commit: None
python: 2.7.9.final.0
python-bits: 64
OS: Linux
OS-release: 4.4.0-78-generic
machine: x86_64
processor:
byteorder: little
LC_ALL: None
LANG: None
LOCALE: None.None

pandas: 0.20.2
pytest: None
pip: 9.0.1
setuptools: 36.0.1
Cython: 0.25.2
numpy: 1.13.0
scipy: 0.19.0
xarray: None
IPython: 5.4.1
sphinx: None
patsy: 0.4.1
dateutil: 2.6.0
pytz: 2017.2
blosc: None
bottleneck: 1.2.1
tables: None
numexpr: 2.6.2
feather: None
matplotlib: 2.0.2
openpyxl: 2.4.8
xlrd: 1.0.0
xlwt: 1.2.0
xlsxwriter: None
lxml: 3.8.0
bs4: 4.6.0
html5lib: 0.999999999
sqlalchemy: 1.1.10
pymysql: 0.7.11.None
psycopg2: None
jinja2: 2.9.6
s3fs: None
pandas_gbq: None
pandas_datareader: None