eternaut commited on
Commit
2b16cb9
·
verified ·
1 Parent(s): 64c81df

Upload interface.py

Browse files
Files changed (1) hide show
  1. src/interface.py +2 -2
src/interface.py CHANGED
@@ -425,8 +425,8 @@ class makeInterface:
425
  # Step 6: Dynamically set column widths based on content
426
  for idx, col in enumerate(dftosave.columns):
427
  # Calculate the maximum length of the column content
428
- max_length = dftosave[col].astype(str).map(len).max()
429
- max_length = max(max_length, len(col)) + 2 # Adding extra space
430
  worksheet.set_column(idx, idx, max_length, data_format)
431
 
432
  # Add autofilter
 
425
  # Step 6: Dynamically set column widths based on content
426
  for idx, col in enumerate(dftosave.columns):
427
  # Calculate the maximum length of the column content
428
+ max_length = dftosave[col].fillna('').astype(str).map(len).max()
429
+ max_length = max(max_length, len(str(col))) + 2 # Adding extra space
430
  worksheet.set_column(idx, idx, max_length, data_format)
431
 
432
  # Add autofilter