Skip to content

[FR] add option to format \hline in to_latex() #28291

Closed
@stevenlis

Description

@stevenlis

Please considering add a parameter to allow users to add \hline to the latex output so that each two rows will have a horizontal line between them.

For example:

import pandas as pd

df = pd.DataFrame(data={'col_1': [1, 2, 4],
                        'col_2': [4, 3, 2]})
print(df.to_latex(index=False))

It will give me:

\begin{tabular}{rr}
\toprule
 col\_1 &  col\_2 \\
\midrule
     1 &      4 \\
     2 &      3 \\
     4 &      2 \\
\bottomrule
\end{tabular}

I wish the output could be

\begin{tabular}{rr}
\toprule
\hline
 col\_1 &  col\_2 \\
\hline
\midrule
     1 &      4 \\ \hline
     2 &      3 \\ \hline
     4 &      2 \\ \hline
\bottomrule
\end{tabular}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions