成功解決 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
目錄
解決問題
解決思路
解決方法
解決問題
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)
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/137357.html
標籤:python
上一篇:Python大學排名問題
