Has anybody faced a FileNotFoundError in JupyterLab (https://jupyter.org/try-jupyter/lab/) when trying to read a .csv file? The file was uploaded in the same directory. I have used a CopyPath option to be sure that the path is correct. Still not working. Any suggestions on how can I fix this?
FileNotFoundError in JupyterLab (https://jupyter.org/try-jupyter/lab/)
340 Views Asked by MaxiP At
2
There are 2 best solutions below
0

I ran into the same problem.
Make sure your working directory is the same as your notebook and .csv file. Check this by running pwd
. You can run ls
to get the list of files in the working directory.
If this helps you find the problem, try shutting down the running kernel completely and attaching a new one. This will change the working directory.
This is unlikely to be an error with Jupyter.
Make sure that the
ReadFile.ipynb
andtheFile.csv
are in the same directory. If they are not, use a relative import.If this still doesn't work, try the following synthax. This is independent of the path you provide.
Here
r
is a special character and means raw string. So prefix it to your string literal.https://www.journaldev.com/23598/python-raw-string:
See: pandas.read_csv FileNotFoundError: File b'\xe2\x80\xaa<etc>' despite correct path
Also, make sure that you don't have unwittingly copied an invisible character.