pandas to_csv: ascii can't encode character
问题 I'm trying to read and write a dataframe to a pipe-delimited file. Some of the characters are non-Roman letters (`, ç, ñ, etc.). But it breaks when I try to write out the accents as ASCII. df = pd.read_csv('filename.txt',sep='|', encoding='utf-8') <do stuff> newdf.to_csv('output.txt', sep='|', index=False, encoding='ascii') ------- File "<ipython-input-63-ae528ab37b8f>", line 21, in <module> newdf.to_csv(filename,sep='|',index=False, encoding='ascii') File "C:\Users\aliceell\AppData\Local