Jupyter Notebook Interface
What is Jupyter Notebook?
Section titled “What is Jupyter Notebook?”Jupyter Notebook is an interactive environment where you can mix:
- Code (Python)
- Text/notes (Markdown)
- Outputs (tables, charts, images)
It’s widely used for:
- Exploratory data analysis (EDA)
- Learning and experimentation
- Quick visualization
- Sharing analysis as a single document
Launching Jupyter Notebook
Section titled “Launching Jupyter Notebook”With Anaconda
Section titled “With Anaconda”- Open Anaconda Navigator
- Choose your environment (optional)
- Click Launch on Jupyter Notebook
From terminal
Section titled “From terminal”Activate your environment first, then run:
jupyter notebookA browser tab opens with the Notebook dashboard.
The Notebook dashboard (files home)
Section titled “The Notebook dashboard (files home)”The first screen usually shows:
- A list of files/folders
- Buttons to create new notebooks
Recommended structure for your data analytics projects:
- A folder per project (e.g.,
titanic-eda/) - A
data/folder for CSV files - A
notebooks/folder for.ipynbnotebooks - A
reports/folder for exported HTML/PDF (optional)
Creating a new notebook
Section titled “Creating a new notebook”From the dashboard:
- Click New → Python 3 (ipykernel) (or similar)
A new .ipynb opens in a new tab.
Understanding cells
Section titled “Understanding cells”Cells are the core concept of notebooks.
Code cell
Section titled “Code cell”- Runs Python code
- Produces outputs
Example:
import math
math.sqrt(81)Markdown cell
Section titled “Markdown cell”- Used for notes and documentation
- Supports headings, lists, links, tables, etc.
Example (Markdown cell):
# Titanic EDA
This notebook explores passenger survival factors.Running cells
Section titled “Running cells”- Run current cell:
Shift + Enter - Run and insert new cell below:
Alt + Enter - Run without moving:
Ctrl + Enter
When a cell runs:
In [1]:indicates the execution order- Outputs appear below the cell
Kernels (the “engine” behind the notebook)
Section titled “Kernels (the “engine” behind the notebook)”A kernel is the process that runs your code.
Key idea:
- If you restart the kernel, you lose variables in memory.
- You must run cells again to recreate them.
Common kernel actions:
- Restart: clears memory and restarts Python
- Interrupt: stops long-running code
In the menu:
Kernel→InterruptKernel→Restart
Saving notebooks
Section titled “Saving notebooks”A notebook is stored as a .ipynb file (JSON-based format).
- Save:
Ctrl + S - Rename: click the title at the top
Visualize it
Section titled “Visualize it”Each time you run a cell, the kernel executes it and hands the result back to the notebook document.
flowchart LR A["Write code in a cell"] --> B["Press Shift+Enter"] B --> C["Kernel executes code"] C --> D["Kernel returns result"] D --> E["Output shown below the cell"] D --> F["In [n] execution count updates"]
A recommended data analytics notebook workflow
Section titled “A recommended data analytics notebook workflow”- Import libraries (NumPy, Pandas, Matplotlib)
- Load data (CSV/Excel/SQL)
- Inspect data (
head(),info(),describe()) - Clean data (missing values, duplicates, types)
- Analyze (groupby, aggregates)
- Visualize (plots)
- Summarize findings (Markdown cells)
Helpful settings
Section titled “Helpful settings”Auto-reload imports (optional)
Section titled “Auto-reload imports (optional)”In a notebook, you can auto-reload local modules:
%load_ext autoreload
%autoreload 2Continue to: Jupyter Shortcuts & Magic Commands to speed up your workflow and learn % / %% notebook magics.
🧪 Try It Yourself
Section titled “🧪 Try It Yourself”Exercise 1 – Track the Execution Counter
Section titled “Exercise 1 – Track the Execution Counter”Exercise 2 – Classify a Cell as Code or Markdown
Section titled “Exercise 2 – Classify a Cell as Code or Markdown”Exercise 3 – Restarting the Kernel Clears Memory
Section titled “Exercise 3 – Restarting the Kernel Clears Memory”pch.coffeeTagline
pch.coffeeCtapch.feedbackHeading
pch.feedbackSubheading