DS Jupyter Setup
Jupyter Notebook is a free tool that lets you write code, see results, and add notes in one document. Data scientists use it daily because every step of the work sits in one place. You type a few lines, press a key, and the answer appears right below.
Picture a school notebook where each page can run calculations and draw charts. Jupyter gives you exactly that.
Three Ways to Get Started
| Option | Best For | Install Needed |
|---|---|---|
| Google Colab | Quick start on any device | No, runs in a browser |
| Anaconda | Full local setup with many libraries | Yes, one installer |
| pip with Jupyter | Light setup for people who already use Python | Yes, one command |
Option 1: Google Colab
Open the Colab website, sign in with a Google account, and create a new notebook. Nothing needs installing. Colab comes with NumPy, Pandas, and Matplotlib preinstalled.
Option 2: Anaconda
Download the Anaconda installer for your operating system and run it. The installer brings Python, Jupyter, and hundreds of data libraries. Open Anaconda Navigator and click Launch under Jupyter Notebook. Your browser opens the notebook home page.
Option 3: pip
Python users can install Jupyter with a single command in the terminal.
pip install notebook
jupyter notebookThe second command starts a local server and opens a browser tab.
Understand the Notebook Layout
+--------------------------------------------------+
| Menu bar: File Edit View Run Kernel |
+--------------------------------------------------+
| Toolbar: Save Add Cell Run Stop |
+--------------------------------------------------+
| [ Markdown cell ] Notes written in plain text |
+--------------------------------------------------+
| In [1]: code cell |
| print("Hello") |
| Out[1]: Hello |
+--------------------------------------------------+
Code cells
A code cell holds Python code. Press Shift and Enter to run it. The result appears directly below the cell.
Markdown cells
A markdown cell holds notes, titles, and explanations. Use a hash sign for headings and a dash for bullet points. Good notes turn a notebook into a readable report.
The kernel
The kernel is the engine that runs your code. It remembers every variable you create until you restart it. Restart the kernel when results look strange, and run all cells from the top to confirm a clean run.
Your First Notebook
name = "Asha"
marks = [72, 85, 90]
average = sum(marks) / len(marks)
print(name, "scored an average of", average)Run the cell and the output reads: Asha scored an average of 82.33333333333333. Round the value with the round function to tidy the display.
Useful Keyboard Shortcuts
| Shortcut | Action |
|---|---|
| Shift + Enter | Run the cell and move to the next |
| Ctrl + Enter | Run the cell and stay |
| A | Insert a cell above |
| B | Insert a cell below |
| D, D | Delete the selected cell |
| M | Change the cell to markdown |
Press Esc first so the notebook leaves typing mode, and the letter shortcuts then work.
Keep Projects Tidy with Virtual Environments
A virtual environment is a private box of libraries for one project. Each project gets its own versions, so an upgrade in one project never breaks another.
python -m venv ds-env
ds-env\Scripts\activate (Windows)
source ds-env/bin/activate (Mac and Linux)
pip install pandas numpy matplotlibGood Notebook Habits
- Give every notebook a clear title and a short purpose note.
- Keep imports in the first cell.
- Name variables with meaningful words, such as monthly_sales.
- Run all cells from top to bottom before sharing.
- Save often, and export a copy as HTML or PDF for readers without Jupyter.
Key Points
- Jupyter combines code, results, and notes in one file.
- Colab needs no setup, while Anaconda gives a full local workspace.
- Virtual environments keep each project's libraries separate.
