I'm placing a pandas dataframe, df
, on a tkinter frame, my_frame
, using the pandastable package. The dataframe has four columns and, despite looking through the pandastable documention, I'm struggling to modify the column widths so that none of the column headers are truncated. Here's my relevant code, where my dataframe, df
has already been created.
from pandastable import Table, config
table = Table(my_frame,dataframe=df,width=425,height=275,showtoolbar=False)
options=config.load_options() # use config to change fontsize option
options={'fontsize':18}
config.apply_options(options,table)
# Now I try to adjust widths of four columns:
table.columnwidths={'Channel':25,'Start (sec)':75,'Stop (sec)':75,'Peak Frequency
(Hz)':250}
It seems no matter what I do, widths of the 'Start' and 'Stop' columns don't expand, which truncates their column headers as in the image below. I've tried increasing them from 75 to 80 to 85, etc., while increasing the overall width of table
correspondingly, but I can't get things to work the way I want.