成功解决ParserError: Error tokenizing data. C error: Expected 2 fields in line 53, saw 3

简介: 成功解决ParserError: Error tokenizing data. C error: Expected 2 fields in line 53, saw 3


目录

解决问题

解决思路

解决方法


 

 

解决问题

File "pandas\_libs\parsers.pyx", line 2021, in pandas._libs.parsers.raise_parser_error

pandas.errors.ParserError: Error tokenizing data. C error: Expected 2 fields in line 53, saw 3

 

 

解决思路

pandas.errors.ParserError:解析错误:标记数据的错误。C错误:在第53行中预期有2个字段,见3

 

 

解决方法

因为读取的是csv文件,分隔默认采用的是逗号,分析可知,读取的数据中某个格内包含两个字段,即值内可能包含两个逗号。

指定参数,error_bad_lines=False

data= pd.read_csv(data_file, error_bad_lines=False)


相关文章
|
4月前
|
JSON Java 数据格式
JSON parse error: Unexpected character (‘t‘ (code 116)): was expecting double-quote to start field n
JSON parse error: Unexpected character (‘t‘ (code 116)): was expecting double-quote to start field n
error C2449: found ‘{‘ at file scope (missing function header?)和error C2059: syntax error : ‘}‘
error C2449: found ‘{‘ at file scope (missing function header?)和error C2059: syntax error : ‘}‘
122 0
|
6月前
|
Perl
报错:error Parsing error: x-invalid-end-tag
报错:error Parsing error: x-invalid-end-tag
135 0
error C2041: illegal digit ‘9‘ for base ‘8‘ | error C2059: syntax error: ‘bad suffix on number‘
error C2041: illegal digit ‘9‘ for base ‘8‘ | error C2059: syntax error: ‘bad suffix on number‘
140 0
成功解决absl.flags._exceptions.UnrecognizedFlagError: Unknown command line flag 'data_format'
成功解决absl.flags._exceptions.UnrecognizedFlagError: Unknown command line flag 'data_format'
|
机器学习/深度学习 Windows
raise RuntimeError(‘Error(s) in loading state_dict for {}:\n\t{}‘.format( RuntimeError: Error(s)..报错
即load_state_dict(fsd,strict=False) 属性strict;当strict=True,要求预训练练权重层数的键值与新构建的模型中的权重层数名称完全吻合;
1541 0
报错:pandas.errors.ParserError: Error tokenizing data. C error: Expected 1 fields in line 7, saw 2
报错:pandas.errors.ParserError: Error tokenizing data. C error: Expected 1 fields in line 7, saw 2
报错:pandas.errors.ParserError: Error tokenizing data. C error: Expected 1 fields in line 7, saw 2