{"id":261,"hash":"5247a75399866058d91dbdc2ed5af6613cac81942134ec368d02ae982a8d3701","pattern":"pandas.parser.CParserError: Error tokenizing data","full_message":"I'm trying to use pandas to manipulate a .csv file but I get this error:\n\npandas.parser.CParserError: Error tokenizing data. C error: Expected 2 fields in line 3,  saw 12\n\nI have tried to read the pandas docs, but found nothing.\n\nMy code is simple:\n\npath = 'GOOG Key Ratios.csv'\n#print(open(path).read())\ndata = pd.read_csv(path)\n\nHow can I resolve this? Should I use the csv module or another language?","ecosystem":"pypi","package_name":"csv","package_version":null,"solution":"you could also try;\n\ndata = pd.read_csv('file1.csv', on_bad_lines='skip')\n\nDo note that this will cause the offending lines to be skipped. If you don't expect many bad lines and want to (at least) know their amount and IDs, use on_bad_lines='warn'. For advanced handling of bads, you can pass a callable.\n\nEdit\n\nFor Pandas < 1.3.0 try\n\ndata = pd.read_csv(\"file1.csv\", error_bad_lines=False)\n\nas per pandas API reference.","confidence":0.95,"source":"stackoverflow","source_url":"https://stackoverflow.com/questions/18039057/pandas-parser-cparsererror-error-tokenizing-data","votes":718,"created_at":"2026-04-19T04:41:41.015039+00:00","updated_at":"2026-04-19T04:51:53.057068+00:00"}