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...
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.