Python Central HubSign in

Data Analytics with Python / Phase 1: Environment and Setup

Jupyter Notebook Interface

Learn the Jupyter Notebook interface, cells, kernels, saving files, and a recommended workflow for data analytics.

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

With Anaconda

  1. Open Anaconda Navigator
  2. Choose your environment (optional)
  3. Click Launch on Jupyter Notebook

From terminal

Activate your environment first, then run:

Shell
jupyter notebook

A browser tab opens with the Notebook dashboard.

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 .ipynb notebooks
  • A reports/ folder for exported HTML/PDF (optional)

Creating a new notebook

From the dashboard:

  • Click New → Python 3 (ipykernel) (or similar)

A new .ipynb opens in a new tab.

Understanding cells

Cells are the core concept of notebooks.

Code cell

  • Runs Python code
  • Produces outputs

Example:

Python
import math
math.sqrt(81)

Markdown cell

  • Used for notes and documentation
  • Supports headings, lists, links, tables, etc.

Example (Markdown cell):

markdown
# Titanic EDA
This notebook explores passenger survival factors.

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)

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 → Interrupt
  • Kernel → Restart

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

Each time you run a cell, the kernel executes it and hands the result back to the notebook document.

diagram Notebook cell execution flow mermaid
What happens between pressing Shift+Enter and seeing output
  1. Import libraries (NumPy, Pandas, Matplotlib)
  2. Load data (CSV/Excel/SQL)
  3. Inspect data (head(), info(), describe())
  4. Clean data (missing values, duplicates, types)
  5. Analyze (groupby, aggregates)
  6. Visualize (plots)
  7. Summarize findings (Markdown cells)

Helpful settings

Auto-reload imports (optional)

In a notebook, you can auto-reload local modules:

Python
%load_ext autoreload
%autoreload 2

Check your understanding

quizCheck yourself
  1. Which shortcut runs the current cell and moves to the next one?

    Show answer

    B — Shift + Enter — Shift + Enter runs and moves down. Ctrl + Enter runs without moving, Alt + Enter runs and inserts a new cell below, and Ctrl + S saves.

  2. What happens to your variables when you restart the kernel?

    Show answer

    B — They are lost from memory and you must rerun the cells — The kernel is the process that runs your code. Restarting clears memory, so cells must be run again to recreate variables.

  3. What does the In [1]: label next to a cell tell you?

    Show answer

    B — The execution order of the cell — The number is the execution count, showing the order in which cells ran.

  4. Why can notebooks cause large diffs in Git?

    Show answer

    B — They store output inside the .ipynb file, which is JSON based — The .ipynb format is JSON and includes outputs, so changing outputs changes the file. Clearing outputs before committing is a common practice.

Next

Continue to: Jupyter Shortcuts & Magic Commands to speed up your workflow and learn % / %% notebook magics.

🧪 Try It Yourself

Exercise 1 – Track the Execution Counter

exerciseYour turn

Tab indents. Press Escape, then Tab, to leave the editor. Control plus Enter runs the code; Control plus Shift plus Enter submits it.

Output
Press Run to see what your code prints.

Exercise 2 – Classify a Cell as Code or Markdown

exerciseYour turn

Tab indents. Press Escape, then Tab, to leave the editor. Control plus Enter runs the code; Control plus Shift plus Enter submits it.

Output
Press Run to see what your code prints.

Exercise 3 – Restarting the Kernel Clears Memory

exerciseYour turn

Tab indents. Press Escape, then Tab, to leave the editor. Control plus Enter runs the code; Control plus Shift plus Enter submits it.

Output
Press Run to see what your code prints.

Was this page helpful?

Let us know how we did