2
votes

I am using Python/Pandas and when I try to:

df = pd.read_table("/test/" + file, sep='\t')

I get the error:

'Error tokenizing data. C error: Expected 24 fields in line 6927, saw 26'

How do I overcome this?

1
Also try: df = pd.read_csv(filename, sep=r'\t'). You're actually placing a tab there, not the character sequence "\" + "t" - Phillip Cloud

1 Answers

2
votes

try this :-)

data = pd.read_csv('file1.csv', error_bad_lines=False)