Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding pandas dataframes to pylatex sections breaks with pandas 2.0 #368

Open
antipisa opened this issue May 17, 2023 · 1 comment
Open

Comments

@antipisa
Copy link

What is the correct way to append a pandas dataframe to a latex section with pandas 2.0?



with section.create(Table(position='H')) as table_sec:

    table_sec.append(NoEscape(df.to_latex(longtable=True, multicolumn=True, sparsify=True)))

causes latexmk to fail when df has a multilevel index or column.

@Rob217
Copy link

Rob217 commented Feb 11, 2025

Does adding usepackage{{multirow}} to your LaTeX preamble fix this? As of Pandas 2.0.0 pandas.DataFrame.to_latex now sets multirow=True by default which requires the multirow package to be added explicitly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants