pd. To_csv, p>
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: strong>
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:
- No code, a solution to the error in the path of reading CSV file by Python: filenotfounderror: [errno 2] no such file or directory: ‘XX. CSV‘
- [Python] pandas Library pd.to_ Parameter arrangement and example of Excel operation writing into excel file
- Illegal escape character in string literal
- Neo4j LOAD CSV Error: Query cannot conclude with LOAD CSV
- Pandas read the CSV file error filenotf oundError:File b ‘***.csv’ does not exist
- python reads csv file is an error _csv.Error: iterator should return strings, not bytes (did you open the file in text)
- The solution to the error of importing CSV from Python to Python
- Python export data (CSV format)
- Edit the file to be edited by GEDIT. After saving, the warning set document metadata failed: setting attribute metadata:: GEDIT position no appears
- The meaning of escape character is’ ^] ‘prompted by telnet under linux / Unix
- Edit the file to be edited by gedit. After saving, a warning of Set document metadata failed: Setting attribute metadata::gedit-position no appears
- Centos8 solves the problem of “failed to set locale, defaulting to c.utf-8”
- Error: No such keg: /usr/local/Cellar/node&install nvm&brew installation&Oh my zsh.git installation&git set alias&No bundle URL prese
- Idea starts Tomcat console with garbled code but no error
- Interesting undefined columns selected from read.table and read.csv
- HBase import CSV file
- Mac boot boot the most detailed explanation, so that the automatic start of the program can not escape
- How to set vscode interface to Chinese
- Error: no such keg: / usr / local / cellular / node & install NVM & Brew install & oh my Zsh. Git install & git set alias & no bundle URL press
- Latex Error pdfTeX error (ext4): \pdfendlink ended up in different nesting level than \pd fstartl