0

Recently I've been working with jupyter notebooks and was trying to read an excel file with pandas and it gives me the following error:

FileNotFoundError: [Errno 2] No such file or directory

But it works fine and reads the file with the exact same lines of code when i run it on Spyder.

Any advice on how to solve this issue?

i.n.n.m
  • 2,936
  • 7
  • 27
  • 51

3 Answers3

1

Seems like an installation error, Do this,

For Python 2

pip install --upgrade --force-reinstall --no-cache-dir jupyter

For Python 3

pip3 install --upgrade --force-reinstall --no-cache-dir jupyter
i.n.n.m
  • 2,936
  • 7
  • 27
  • 51
  • When I run it - the notebook through Anaconda it works fine. However, that issue only came when i ran Jupyter through the website - jupyter.org > Try it in your browser, and without having any software installed. – Sherif Elessawy Dec 22 '17 at 19:39
0

I had a similar issue in the past. After having changed the Jupyter start folder as suggested in this post: how to change jupyter start folder? , just put the excel file in this folder and to load them it isn't necessary to write the path. This is enough:

xl_file = pd.ExcelFile('myFile.xls')
Joe
  • 12,057
  • 5
  • 39
  • 55
0

Give full path while reading a file. It's running in spyder because the excel file and spyder are in the same folder while your jupyter is in a different folder. So it's not able to read the file.

df = pd.read_csv(full_path)
Abhishek Sharma
  • 1,909
  • 2
  • 15
  • 24
  • it's the full path I'm giving. I was working with jupyter notebook website when that happened. when i ran the notebook through anaconda it found the file with the same path I'm wondering why. – Sherif Elessawy Dec 22 '17 at 15:14