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.
# import required libraries to continue
import os
from IPython.display import HTML
from IPython.display import Image
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.
Image(os.path.join('pyintro_resources/img', 'Jupyter_dashboard.png'))
To create a new notebook, click New -> Notebook in the Dashboard.
HTML('<video width="800" controls><source src="mov/new_notebook.mov" type="video/mp4"></video>')
To open an existing notebook, click on the Notebook name in the Dashboard.
HTML('<video width="800" controls><source src="mov/open_notebook.mov" type="video/mp4"></video>')
These components are highlighted in the following image.
Image(os.path.join('pyintro_resources/img', 'Jupyter_select_annotate.png'))
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.
Image(os.path.join('pyintro_resources/img', 'Jupyter_notebook_head.png'))
To run a cell or cells, first select the cells you want to run, and then you can either:
HTML('<video width="800" controls><source src="mov/run_cell.mov" type="video/mp4"></video>')
To save the notebook, hit the save button. The Checkpoint Status at the top of the Notebook Window will update.
HTML('<video width="800" controls><source src="mov/save_notebook.mov" type="video/mp4"></video>')
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 contains dropdown menus for selecting commands.
Image(os.path.join('pyintro_resources/img', 'menu_bar.png'))
The Tool Bar has buttons for easy access to commonly used commands.
Image(os.path.join('pyintro_resources/img', 'tool_bar.png'))
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.
Image(os.path.join('pyintro_resources/img', 'tool_bar_shortcut.png'))
This is what the Command Palette looks when opened:
Image(os.path.join('pyintro_resources/img', 'keyboard_shortcuts.png'))
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.
Image(os.path.join('pyintro_resources/img', 'menu_bar_help.png'))
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 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.
To create a new cell, you can either:
Also, if you run the last cell in a Notebook, a new cell is typically created below.
HTML('<video width="800" controls><source src="mov/new_cell.mov" type="video/mp4"></video>')
To delete cells, first select them and you can either:
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:
HTML('<video width="800" controls><source src="mov/cell_types.mov" type="video/mp4"></video>')
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!