I have completed a few different dataframes with JupyterLabs but it seems to be selective for which files it will and won’t read in terms of the csv being in the same directory as the kernel. I have attached a screenshot of my screen and if anyone can help me troubleshoot this issue it would be greatly appreciated. I have already tried restarting my kernel, shutting it down and starting a new kernel, checking for duplicates in other directories, and completely shutting down JupyterLab and Anaconda to restart the program. Thank you in advance for any help given!
You probably me same directory as the Jupyter .ipynb
file? More specifically, you mean ‘current working directory’, which is a more general concept.
You need to determine the current working directory in your Jupyter Notebook which may not be as you expect. Run the folllowing in a cell:
pwd
That stands for ‘print working directory’ and then compare that you path you are using. You probably also want to run ls
in a cell and see what it says. ls
returns the names of files and subdirectories in the current working directory.
Finally, you can change the current working directory using %cd
followed by the path, or followed by the name of a subdirectory of the current working directory. Or do %cd ..
to go up one level. Make sure you include the magic symbol, %
. That is the only way to make the change of the directory persistent in the running session. If you restart the kernel though, you end up back at square one and have to do that all again. So usually once you determine the proper combination of commands, leave it in the notebook as a cell to run whenever the notebook starts up where it usually does.
This isn’t really a Jupyter issue. You should practice this with a command line console (terminal) or IPython console. You can get an IPython console by entering ipython
in your terminal where you use Jupyter. Jupyter inherits a lot from IPython, and in fact used to be called ‘IPython notebook’.
That screenshot is unreadable on my current computer. Please read about how to share code and errors on forums such as this. Please read Getting good answers to your questions and revise your post accordingly. Pay particular attention to the admonition ’ DO NOT post images of code, data, error messages, etc’, under the section ‘Help others reproduce the problem’, in the link to How do I ask a good question? at the bottom there.
For pasting code in so it is readable in forums such as this, you’ll want to learn about ‘block code formatting’ here. (Or see about ‘fenced code blocks’ here. They are both the same thing if you look into the details. They just have slightly different terms used in the two locations.