Pandas to_csv not retaining formatting

Viewed 93

I am using Pandas ExcelWriter to create an excel file from a dataframe. I have also applied formatting on the excel file like Font size, font colour etc

Now I am trying to convert the excel to CSV using to_csv method.

After conversion, the CSV file is not retaining any formatting done previously.

My question is how do I retain formatting in CSV ?

1 Answers

CSV cannot store formatting. If you want that, save as an excel file. (Or of course other outputs that save formatting - including HTML - but have other feature drawbacks - it depends on what you need.)

Related