pd.to_csv,Error: need to escape, but no escapechar set

pd. To_csv,

df3.to_csv('E:\\data\\xxxx.csv',index=False,header= 0,sep='|', encoding="utf-8", quoting=csv.QUOTE_NONE)

Error: Error: need to escape, but no escapechar set

reason: this problem may be due to the fact that the description contains’ |’, ‘|’ is also a delimiter. CSV attempts to escape it, but cannot, because there is no CSV. Escapechars setting

solution:
provides a escapechar, when quoting for QUOTE_NONE, specify a character makes separator without limit, in order to escape.

df3.to_csv('E:\\data\\xxxx.csv',index=False,header= 0,sep='|', encoding="utf-8", quoting=csv.QUOTE_NONE,escapechar='|')

reference:

https://stackoverflow.com/questions/32107790/writing-to-csv-getting-error-need-to-escape-for-a-blank-string

Read More: