Skip to content

DataFrame.to_latex() produces an extra rule in some cases #7124

Closed
@pzakielarz

Description

@pzakielarz

When a DataFrame with column names is converted to latex, and header=False is passed, the \midrule that normally follows the headers should be removed.

>>> df = pd.DataFrame(np.arange(6).reshape(3,-1), columns=['A', 'B'])
>>> print df.to_latex(header=False)
\begin{tabular}{lrr}
\toprule
0 &  0 &  1 \\
\midrule
1 &  2 &  3 \\
2 &  4 &  5 \\
\bottomrule
\end{tabular}
>>> pd.show_versions()

INSTALLED VERSIONS
------------------
commit: None
python: 2.7.6.final.0
python-bits: 64
OS: Darwin
OS-release: 12.5.0
machine: x86_64
processor: i386
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8

pandas: 0.13.1
Cython: 0.20.1
numpy: 1.8.0
scipy: 0.13.3
statsmodels: None
IPython: 2.0.0
sphinx: 1.2.2
patsy: None
scikits.timeseries: None
dateutil: 2.2
pytz: 2013.9
bottleneck: 0.6.0
tables: 3.1.1
numexpr: 2.1
matplotlib: 1.3.1
openpyxl: None
xlrd: 0.9.2
xlwt: None
xlsxwriter: None
sqlalchemy: None
lxml: None
bs4: None
html5lib: None
bq: None
apiclient: None

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions