Python - error while loading data from csv to dataframe

 

While trying to load the CSV file into the pandas data frame received the error.

I got this error

ProblemParserError: Error tokenizing data. C error: Expected 2 fields in line 398, saw 3





Solution: 

The file was separate by "|" symbol

so we need to use the code 

df = pd.read_csv('file.csv', sep='|')




Comments

Popular posts from this blog

SQL Interview Questions - SqlWorldCup

SQL Interview Questions - Second hightest Salary