I couldn't find a place for me to change the working directory in Jupyter Notebook, so I couldn't use the pd.read_csv method to read in a specific csv document.
Is there any way to make it? FYI, I'm using Python3.5.1 currently.
Thanks!
Select your directory you want to have as home for your jupyter, and copy it with Ctrl + C , for example: C:\Users\username\Python Projects. Make sure to remove #, as it is as comment. Make sure to double slash \\ on each name of your path. Ctrl + S to save the config.py file !!!
Running os.chdir(NEW_PATH)
will change the working directory.
import os
os.getcwd()
Out[2]:
'/tmp'
In [3]:
os.chdir('/')
In [4]:
os.getcwd()
Out[4]:
'/'
In [ ]:
You may use jupyter magic command as below
%cd "C:\abc\xyz\"
First you need to create the config file, using cmd :
jupyter notebook --generate-config
Then, search for C:\Users\your_username\.jupyter folder (Search for that folder), and right click edit the jupyter_notebook_config.py.
Then, Ctrl+F: #c.NotebookApp.notebook_dir ='' . Note that the quotes are single quotes. Select your directory you want to have as home for your jupyter, and copy it with Ctrl+C, for example: C:\Users\username\Python Projects.
Then on that line, paste it like this : c.NotebookApp.notebook_dir = 'C:\\Users\\username\\Python Projects'
Make sure to remove #, as it is as comment.
Make sure to double slash \\ on each name of your path. Ctrl+S to save the config.py file !!!
Go back to your cmd and run jupyter notebook.
It should be in your directory of choice. Test it by making a folder and watch your directory from your computer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With