0

I am trying to read a TSV file to Pandas Dataframe and I am getting an error

Error tokenizing data. C error: Expected 1 fields in line 6, saw 2

Given below is the code I am using.

list_ = []
    for file_ in allFiles:
         try:
             df = pd.read_csv(file_, index_col=None, header=None, sep='\t')
             list_.append(df)
             temp = pd.concat(list_)
         except pd.errors.EmptyDataError:
             continue

Update:

1   "ABC"   ""  "XYZ"   "686"   "12345" 
2   "ABC"   ""  "KLM"   "391"   "23456" 
3   "ABC"   ""  "PQR"   "601"   "45678" 
4   "ABC"   ""  "HELLO" "688"   "235754"    
5   "ABC"   ""  "MIKE"  "619"   "355355"    
6   "KINROC"    ""  "NAME"  "1275"  "45433" 
7   "PEPCOL"    ""  "SAMPLE"    "457"   "5553435"   
Kevin Nash
  • 1,511
  • 3
  • 18
  • 37

0 Answers0