Error reading csv files
by
Debojit23
- Tuesday, March 29, 2022, 08:58:27
I tried to read the 'css_main_training.csv' using pandas.
main_train = pd.read_csv('../input/fedciss2022/css_main_training/css_main_training.csv')
I am running into this following error :
ParserError: Error tokenizing data. C error: Expected 1 fields in line 27847, saw 2
If anyone have a solution to read the csv files, please do help out.
RE: Error reading csv files
by antoni-jamiolkowski - Tuesday, March 29, 2022, 10:24:57
Hello,
You should check separator in the file and a default separator in the pandas function :) In css_main_training.csv it is semicolon (;) yet in the pandas function the default is comma (,).
>>> import pandas as pd
>>> data = pd.read_csv("css_main_training.csv", sep=";")
>>>
Best regards,
Antoni JamioĊkowski