While importing a csv with
import pandas as pd
test_df = pd.read_csv('test.csv',sep='\t')
I encountered error Error tokenizing data. C error: Expected 2 fields in line 173840, saw 3
As suggested here I applied
test_df = pd.read_csv('test.csv',sep='\t', error_bad_lines=False)
Instead of just skipping the problematic row, it seems that it started copying again from a random line (89465 in this case).
Actual data in the original csv:
Data copied from the csv:
Do you have any idea about why is this happening and what could I do to prevent it?