# df.to_latex() table width pylatex

i am using Pylatex in order to generate automatic reports.

In order to generate Table from a dataframe i am using the following function:

def createTable(doc,df,TableTitle):
with doc.create(Table(position='htbp')) as table:
table.append(Command('centering'))
table.append(NoEscape(df.to_latex(escape=False)))


The thing is i get a pdf file where some of the columns of the dataframe are sliced.

How i can fix this issue? how i can apply width parameter in this table creation?

doc.packages.append(Package('adjustbox'))

• While this works, it will reduce the font size, which is not ideal. It's possible to change the setup of the table via options to the to_latex method, for example you can change the column types with the column_format option. It's hard to give more specific advice without knowing what's in the table though. – Torbjørn T. Jul 24 '19 at 19:18