Skip to content
Advertisement

Error tokenizing data. C error: Expected x fields in line 5, saw x

I keep getting this error. I don’t even know how to identify the row that is in error as the data I am requesting is jumbled. I can’t provide a URL to the API but I will provide a sample of the first few lines of data.

My code:

JavaScript

Error:

JavaScript

Data from API:

JavaScript

Advertisement

Answer

Since you don’t specify a separator for columns in the data, python has to guess and it guessed wrong. Be specific.

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement