How to Solve ParserError: Error tokenizing data. C error: Expected 2 fields in line 53, saw 3

How to solve 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


Solving the problem
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

Solution
ParserError: Error tokenizing data.

Solution
Because the read is a csv file, the separation default is comma. Analysis shows that the read data contains two fields in a certain cell, that is, the value may contain two commas.

Specify the parameters that error_bad_lines=False

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

Similar Posts: