JelteF / PyLaTeX

A Python library for creating LaTeX files
https://jeltef.github.io/PyLaTeX/
MIT License
2.24k stars 287 forks source link

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

Open antipisa opened 1 year ago

antipisa commented 1 year ago

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.