Search code examples
pythonpandascsvgoogle-colaboratory

Why is Google Colab raising an error for reading in a csv and jupyter notebook isn't?


I'm receiving this error when attempting to read in csv data using python and pandas. I don't experience this error in Jupyter notebooks but I'm trying to use google colab and experience the error there. Any ideas why google colab is raising the error but jupyter isn't?

df = pd.read_csv('./final_data_for_modeling.csv')

---------------------------------------------------------------------------
ParserError                               Traceback (most recent call last)
<ipython-input-7-3a755ce18082> in <module>()
      2 
      3 # Load the dataset into a pandas dataframe.
----> 4 df = pd.read_csv('./final_data_for_modeling.csv')


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

For contrast here is a screenshot of the success in jupyter

Screenshot of the success in jupyter

If you'd like to take a look at the csv here is a dropbox link to the data:

https://www.dropbox.com/s/i3od76b52t19vzr/final_data_for_modeling.csv?dl=0


Solution

  • This works out of the box for me. Here's a complete notebook: https://colab.research.google.com/drive/1CATW8DtNh9wZTKpp5bV2DqfU6ChkFgty

    Full code & output: enter image description here