0
votes

i am trying to load a csv file

import pandas as pd dfc = pd.read_csv('data/Vehicles0515.csv', sep =',')

but i have the following error

ParserError: Error tokenizing data. C error: Expected 22 fields in line 3004427, saw 23

i have read to include error_bad_lines = False

but it doesn't solve the problem

Thanks a lot

1

1 Answers

0
votes

Sometimes parser is getting confused by the head of csv file. try this:

dfc = pd.read_csv('data/Vehicles0515.csv', header=None)
or 
dfc = pd.read_csv('data/Vehicles0515.csv', skiprows=2)

Also you don't need provide an comma separator owing to fact that comma is default value in pandas read_csv method.