0

I am trying to read a csv file using pandas read_csv in a Jupyter notebook. I used the same function to read different csv files and it was working fine. However, today the function keeps giving me index errors (for both csv and xlsx files).

Tried different ways, but couldnt get around with this error. I manually deleted the lines where python said there was an error. However, it did not work either. When I run the same code in the console it works fine.

Python version: 3.6.5.

The code I ran:

d = pd.read_csv('/Users/.../fullfillment_details.csv')

The error message:

IndexError: index 13 is out of bounds for axis 0 with size 13

How can I fix this index error, get the Jupyter Notebook work again? I attached the screen shots of both the notebook and the console. Thanks in advance...

enter image description here

steve
  • 31
  • 4

1 Answers1

0

It turned out that I shouldn't have set the max_rows to max_columns display to -1. Instead of

pd.set_option("display.max_rows",-1)
pd.set_option("display.max_columns",-1)

it is better to give integer values, something like

pd.set_option("display.max_rows",1000)
pd.set_option("display.max_columns",100)

Did not have any problem like this in the past. So, I am not sure what the actual issue here. I wanted to keep this here in case someone else d have the same issue.

steve
  • 31
  • 4
  • are you using your OS's main python distribution for your work? Consider creating a virtual environment (e.g., [conda](https://conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html)) to isolate your work environment and have more control. – jeschwar Jun 11 '19 at 16:45
  • not sure if [this](https://github.com/jupyter/notebook/issues/4667) is also you but it has been logged as an issue in the `notebook` repo – jeschwar Jun 11 '19 at 18:49
  • @jeschwar I updated my answer above with the actual issue. thanks for your messages. – steve Jun 11 '19 at 19:04