0

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 Answer 1

0

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.