Excel output in non-ascii encodings by jtornero · Pull Request #3710 · pandas-dev/pandas (original) (raw)
First, I would like to thank the developers for this excellent work.
My patch is about the possibility of specify the workbook encoding when making output to excel xls files. By default, pandas hasn't it, so say-so non ascii language speakers weren't able to save files with special characters, receiving an error like, for instance:
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 2: ordinal not in range(128)
My change makes possible to specify both in ExcelWriter and DataFrame.to_excel the parameter encoding which is passed by both the ExcelWriter init and DataFrame.to_excel functions to the appropiate xlwt function to make the trick.
I'm sorry my explanations aren't very proffesional, but I think they are enough for this purpose.
Also I have to apologize in the sense that I've run the tests with nosetests and I lack of knowledge about tests interpretation, but I have checked the log and no error comes from the modules/files I've worked with.
Best regards,
Jorge Tornero