I'm using Pandas and exporting data to excel using XlsxWriter. One of the data columns has floats and needs to be formatted as percent, so this is how I do it:
percent_fmt = workbook.add_format({'num_format': '0.00%'})
worksheet.set_column('E:E', percent_fmt)
After that the following error appears:
File "C:\Program Files\Anaconda\lib\site-packages\xlsxwriter\worksheet.py", line 4688, in _write_col_info / float(max_digit_width) * 256.0) / 256.0
TypeError: unsupported operand type(s) for *: 'Format' and 'int'
What am I doing wrong here?
workbook
object that is necessary to create thepercent_fmt
setting here. Is it possible to createpercent_fmt
some other way? I looked on your docs and importing xlsxwriter and pulling the workbook object from it may not work for my application. – Parthenogenesis