Skip to content

BUG: Styler.to_latex permanently impacts table_styles for successive calls #42320

Closed
@attack68

Description

@attack68

For

styler = DataFrame([[1]]).style

doing

styler.to_latex(hrules=True) (or any other kw argument which impacts table_styles)

results in:

\begin{tabular}{lr}
\toprule
{} & {0} \\
\midrule
0 & 1 \\
\bottomrule
\end{tabular}

Now doing

styler.to_latex(hrules=False)

still results in

\begin{tabular}{lr}
\toprule
{} & {0} \\
\midrule
0 & 1 \\
\bottomrule
\end{tabular}

because the table_styles attribute on styler has been overwritten by first call which dominates the second.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugIO LaTeXto_latexStylerconditional formatting using DataFrame.style

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions