Jupyter Notebooks: Quick Start

Interactive Jupyter Notebook

This notebook provides a very basic introduction to Jupyter Notebooks, including how to work with the notebook dashboard and create a new notebook. This notebook was created by Becky Vandewalle.


The Jupyter Notebook interface makes interactive computing easily accessible. You can access notebooks and files using a web dashboard, and explore notebooks in their own page.

In [1]:
# import required libraries to continue

import os
from IPython.display import HTML
from IPython.display import Image

The Notebook Dashboard

After typing cybergis-jupyter.cigi.illinois.edu into an internet browser, the first page to show up will be the Notebook Dashboard. The Dashboard allows you to view and work with your Notebooks, files, and folders.

In [2]:
Image(os.path.join('pyintro_resources/img', 'Jupyter_dashboard.png'))

Creating a new Notebook

To create a new notebook, click New -> Notebook in the Dashboard.

In [3]:
HTML('<video width="800" controls><source src="mov/new_notebook.mov" type="video/mp4"></video>')

Opening an existing Notebook

To open an existing notebook, click on the Notebook name in the Dashboard.

In [4]:
HTML('<video width="800" controls><source src="mov/open_notebook.mov" type="video/mp4"></video>')

Working with Files and Folders on the Dashboard

  • The New dropdown box can also be used to create new files or folders, or open a new terminal session.
  • The Upload button, located to the left of the New dropdown box, can be used to upload a file to the Dashboard from your computer.
  • Clicking the Selection toggle, located to the left of the each file or folder, can be used for common actions such as renaming, copying, moving, viewing, or deleting that item. The menu appears near the top of the Dashboard. The options available will change depending on the item you select and its current state, for example, you can use this to shut down a running Notebook.

These components are highlighted in the following image.

In [5]:
Image(os.path.join('pyintro_resources/img', 'Jupyter_select_annotate.png'))

The Notebook Window

Once you open a Jupyter Notebook, you can interact with it or edit it in the Notebook Window. An example of this interface is displayed below.

In [6]:
Image(os.path.join('pyintro_resources/img', 'Jupyter_notebook_head.png'))

Running A Cell

To run a cell or cells, first select the cells you want to run, and then you can either:

  • select Cell -> Run Cells in the Menu Bar
  • press the Run button in the Tool Bar
  • press Enter (or Shift+Return)
In [7]:
HTML('<video width="800" controls><source src="mov/run_cell.mov" type="video/mp4"></video>')

Saving the Notebook

To save the notebook, hit the save button. The Checkpoint Status at the top of the Notebook Window will update.

In [8]:
HTML('<video width="800" controls><source src="mov/save_notebook.mov" type="video/mp4"></video>')

Diving deeper into the Notebook Window

There are multiple ways to trigger each command you will use when working with a Jupyter Notebook. Commands can be accessed using the Menu Bar or Keyboard Shortcuts. Common commands are also present on the Tool Bar.

The Menu Bar and Tool Bar

The Menu Bar contains dropdown menus for selecting commands.

In [9]:
Image(os.path.join('pyintro_resources/img', 'menu_bar.png'))

The Tool Bar has buttons for easy access to commonly used commands.

In [10]:
Image(os.path.join('pyintro_resources/img', 'tool_bar.png'))

Finding More Shortcuts

A variety of Keyboard Shortcuts are available to make editing and running Notebooks quick. If you want to look up a specific shortcut, the Command Palette, highlighted below, is a useful resource.

In [11]:
Image(os.path.join('pyintro_resources/img', 'tool_bar_shortcut.png'))

This is what the Command Palette looks when opened:

In [12]:
Image(os.path.join('pyintro_resources/img', 'keyboard_shortcuts.png'))

Getting Help

Additional resources are available under the Help menu dropdown. You can take an interactive tour of the Notebook interface, view and edit Keyboard Shortcuts, and find links to external help resources for both Jupyter Notebooks, Python, and common libraries.

In [13]:
Image(os.path.join('pyintro_resources/img', 'menu_bar_help.png'))

Basic Notebook Editing

Jupyter notebooks have two modes for interaction, Command Mode and Edit Mode. To build your own notebook, you will need to create new cells in Command Mode and edit their contents in Edit Mode.

Command Mode vs Edit Mode

Command Mode is used to select cells and view or edit the notebook as a whole by adding, deleting, running cells, and changing their properties. In Edit Mode, on the other hand, you can change what a certain cell contains.

Switch from Command Mode to Edit Mode by clicking on a cell (you may need to click multiple times), or by pressing Esc.

Switch from Edit Mode to Command Mode by pressing Return or by running a cell.

Creating Cells

To create a new cell, you can either:

  • select Insert -> Insert Cell Above or Insert -> Insert Cell Below in the Menu Bar
  • press the Insert Cell Below Button in the Tool Bar
  • press a or b in Command Mode (inserts cell above or below)

Also, if you run the last cell in a Notebook, a new cell is typically created below.

In [14]:
HTML('<video width="800" controls><source src="mov/new_cell.mov" type="video/mp4"></video>')

Deleting Cells

To delete cells, first select them and you can either:

  • select Edit -> Delete Cells in the Menu Bar
  • press dd in Command Mode

Cell Types

There are two basic cell types, Code Cells and Markdown Cells. Code cells are enclosed in a light grey box and run code snippets when you run them. Markdown cells have a white background and are often used to display information using HTML or Markup. You can see the difference between running these two types of cells in the following video:

To change a cell type, you can either:

  • select Cell -> Cell Type -> Code or Cell -> Cell Type -> Markdown in the Menu Bar
  • select the cell type in the dropdown box in the Tool Bar
  • press m in Command Mode to switch a code cell to markdown
  • press y in Command Mode to switch a code cell to markdown
In [15]:
HTML('<video width="800" controls><source src="mov/cell_types.mov" type="video/mp4"></video>')

Next Steps

This was just an quick overview - there is much more you can do using Jupyter Notebooks!

For a more in depth look at working with Jupyter Notebooks, see this notebook!