Solution:
Add when reading files quoting=csv.QUOTE_ NONE
data = pd.read_ csv(path + ‘/’ + fn,quoting=csv.QUOTE_ NONE)
Quote mode is no reference. When reading, it is considered that the content is not surrounded by the default reference character (“).
Relevant knowledge points:
pandas.read_ CSV parameters
quoting : int or csv.QUOTE_* instance, default 0
Controls quotation mark constants in CSV.
Optional quote_ MINIMAL (0), QUOTE_ ALL (1), QUOTE_ NONNUMERIC (2) ,QUOTE_ NONE (3)
Other similar errors
1、pandas.errors.ParserError: Error tokenizing data. C error: Expected * fields in line *, saw *
solve:
Method A. add parameters when reading files error_ bad_ Lines = false # add parameters
data= pd.read_ csv(data_ file, error_ bad_ lines=False)
When reading CSV files, the separator defaults to comma. Analysis shows that a cell in the read data contains two fields, that is, the value may contain two commas
Method B. open the file to another format required by the dataset. Do not be lazy and modify the suffix directly. For example, some formats can be modified by converting Excel to CSV and saving manually to ensure uniform format
The fundamental reason is that the data format is incorrect, which makes it impossible to read correctly. We should solve it from the aspect of file content format
Read More:
- Python error: pandas.errors.ParserError: Error tokenizing data. C error: Expected 3……
- Solution pandas.errors.ParserError : Error tokenizing data. C error: Buffer overflow caught
- How to Fix Parser rerror: error tokenizing data. C error: expected 2 fields in line 53, saw 3
- C language string processing error warning, c4996, sprintf, predicted, c4996, strcpy, c4996, strcat
- In scan(file = file, what = what, sep = sep, quote = quote, dec = dec, : EOF within quoted string
- How to Fix Sklearn ValueError: This solver needs samples of at least 2 classes in the data, but the data
- Differences between length() size() and C strlen() of C + + string member functions
- Error 1136 (21s01): column count doesn’t match value count at row 1
- Solve the problem of error: cannot pass objects of non trivially copyable type ‘STD:: String’ in C / C + +
- Error c2951: template declaration can only be used at the global, namespace, or class scope. Error c2598: link specification must be at the global scope
- MySQL error code 1217 (ER_ROW_IS_REFERENCED): Cannot delete or update a parent row: a foreign key co
- Python conversion hex to string, high and low data processing
- Freemarker Failed at: ${ findObj.applyDateStart? string(“yyyy-MM… Template
- SQL Error (3621): String or binary data would be truncated The statement has been terminated. */
- String operation to delete the character at the specified position
- Split keyword in ABAP when the separator is at the beginning and end of the string
- C++ string substr()
- A repeated string is composed of two identical strings. For example, abcabc is a repeated string with length of 6, while abcba does not have a duplicate string. Given any string, please help Xiaoqiang find the longest repeated substring.
- Under Ubuntu environment, eclipse writes C program, and error starting process is reported
- C # generate data in DataGridView into XML file