How to make sure the result of Pandas.to_csv does not have non-ASCII code?

MRAB python at mrabarnett.plus.com
Wed May 31 14:51:38 EDT 2017


On 2017-05-31 17:52, David Shi via Python-list wrote:
> How to make sure the result of Pandas.to_csv does not have non-ASCII code?
> 
Specify the encoding as 'ascii':

     df.to_csv(path, encoding='ascii')

If there's a non-ASCII character that it can't write, it'll raise an 
exception.



More information about the Python-list mailing list