HomeCourseModule 02 › A two-minute tour of Jupyter notebooks

A two-minute tour of Jupyter notebooks

Module 02 · Setting Up Your Environment7 min readBeginner

What you'll learn

  • Create and delete cells in Jupyter
  • Know the keyboard shortcuts that save time
  • Save and export a notebook

Why you'll use Jupyter all the time

Jupyter is the notebook tool that came with Anaconda. It's the standard way to do data analysis in Python: you type a few lines of code, run them, see the result instantly, write a note about what you saw, type a few more lines. Repeat. Save the whole thing as a document you can share.

Open a notebook

Anaconda Navigator → Jupyter Notebook → Launch. Browser opens. Navigate to a folder. Click New → Python 3.

The anatomy of a notebook

The keyboard shortcuts that change your life

ShortcutWhat it does
Shift+EnterRun the current cell and move to the next
Ctrl+EnterRun the current cell and stay on it
Alt+EnterRun and insert a new cell below
Esc then AInsert a new cell above
Esc then BInsert a new cell below
Esc then D DDelete the current cell
Esc then MTurn the current cell into a Markdown note
Esc then YTurn it back into code

Walkthrough: build a tiny analysis notebook

Make a Markdown title cell

Press Esc M, then type # My first analysis. Shift+Enter. Notice it renders as a big heading.

Make a code cell that creates some data

import pandas as pd
sales = pd.DataFrame({
    "rep":   ["Aisha", "Ben", "Carlos", "Dora", "Eve"],
    "deals": [12, 7, 19, 8, 14],
    "value": [42000, 18000, 71000, 22000, 39000],
})
sales

Shift+Enter. You see the table.

A second code cell that summarises

sales["value"].sum()

Shift+Enter. You see 192000.

Save

Ctrl+S (or Cmd+S on Mac). The file is saved as Untitled.ipynb. Click the title at the top to rename it.

Export

File → Download as → HTML gives you a self-contained web page you can email. Download as → PDF gives you a printable version. Download as → Notebook (.ipynb) gives you the raw file someone else can open in their Jupyter.

💡 The "last expression auto-prints" trick
A code cell automatically prints the result of its last line, without needing print(). That's why sales on its own showed the whole table.

Key takeaways

  • Jupyter = the analysis tool that came with Anaconda.
  • Shift+Enter runs a cell. Esc M turns it into a note.
  • The last line of a cell prints automatically.
  • Save as .ipynb for editing, or export to HTML / PDF to share.

Exercise

Open Jupyter. Make a new notebook called warmup.ipynb. Build it with:

  1. A Markdown heading: "Warm-up exercise".
  2. A code cell that creates a list of your five favourite numbers.
  3. A code cell that prints their sum.
  4. A Markdown cell at the bottom that says how surprising the answer was (or wasn't).
  5. Save it. Export it as HTML. Open the HTML file in your browser.
📹 Video walkthrough
A video walkthrough of this lesson will be embedded here. Until then, the written walkthrough above mirrors what the video will cover step-for-step.