Let’s see how to set up a Jupyter Notebook on your local machine and read a CSV file from your desired folder
There are 3 steps involved here:
- Install Jupyter Notebook using Anaconda
- How to open Jupyter in your favorite folder
- Read a CSV file using Jupyter
Step 1: Install Jupyter Notebook
You can install it via Pip or Anaconda
Refer to these tutorials below:
Step 2: Change the default folder
This is the step that’s most confusing and you won’t find the right answer unless you try so many ways.
So here first open the Jupyter Application folder, which looks like this:
In case you don’t find the right folder, search for Jupyter Notebook -> Open folder location:
Then go-to Jupyter Notebook location -> right click -> Properties:
Then Properties -> Shortcuts -> Target
Now, this is where you need to change the Target:
Old Target path:
C:\ProgramData\Anaconda3\python.exe C:\ProgramData\Anaconda3\cwp.py C:\ProgramData\Anaconda3 C:\ProgramData\Anaconda3\python.exe C:\ProgramData\Anaconda3\Scripts\jupyter-notebook-script.py "%USERPROFILE%/"
New Target path: (for example you want to open in D drive D: )
C:\ProgramData\Anaconda3\python.exe C:\ProgramData\Anaconda3\cwp.py C:\ProgramData\Anaconda3 C:\ProgramData\Anaconda3\python.exe C:\ProgramData\Anaconda3\Scripts\jupyter-notebook-script.py "D:"
Click on Apply, and now you are all set!
I would recommend pinning this shortcut to the taskbar as well:
If you just double-click on the Jupyter icon, it will open Jupyter Notebook in your folder (which you mentioned in the path)
Step 3: Read a CSV
For this, all you need is, to make sure your CSV file exists in the same folder as your mentioned path (ex: if Jupyter opens in D: drive, then make sure your CSV is also in the same folder!!)
just do:
import pandas as pd
df = pd.read_csv("your_filename.csv")
Finally, you are able to read CSV files using Jupyter by making all the changes!
If you want to get the latest updates on my website about new posts, join the Telegram channel here