Skip to content

Latest commit

 

History

History
58 lines (40 loc) · 4.29 KB

jupyter.md

File metadata and controls

58 lines (40 loc) · 4.29 KB

The Jupyter notebook is an open source semi language agnostic programming development environment aimed at simplifiying the creation and sharing of documents that contain live code, figures, and explanatory text. The Jupyter package is installed by default as part of the Anaconda environment and can be updated using the conda package management system.

Executing Code in a Notebook

  1. To open a jupyer notebook, first open a windows or OSX terminal.

  2. Via the command line, navigate to the folder in which you would like to open the notebook.

  3. Then type the following in your terminal:

jupyter notebook
  1. In your default web browser (e.g. Firefox, Chrome, or Safari), you should now see a window that looks like this. jupyter notebook homescreen, which is a list of folders and files in the directory in which the notebook was opened

  2. To open a new notebook, navigate to the New drop down menu in the upper right corner and select Python 3 from the new menu.

notebook with new menu selected and options listed: Python 3, Text File, Folder, Terminal

  1. This is what an empty Jupyter notebook looks like: empty jupyter notebook with menubar across the top: file, edit, view, insert, cell, kernel, widgets, help. Below the menu is an empty code block

  2. Rename the notebook by clicking on the Untitled at the top of the page. That will spawn this window:

rename window with text box to enter new name and cancel and rename buttons

  1. The light gray boxes are Python interpreter cells in which code can be executed. Here, we write the code print("hello world").

light gray code cell with print("hello world") in it

  1. To run the the code, we press <shift> + <enter>. The results are printed in the white cell underneath the code cell.

light gray code cell with print("hello world") in it, "hello world" printed out on white underneath

  1. After a cell is executed, Jupyter notebook automatically adds a new cell underneath: Annotated screenshot where the code and output cells are labeled. New cell underneath highlighted in green.

Cell Menu

A Jupyter notebook consists of cells. Each cell can contain code or text. The menubar for managing these cells is at the top of the notebook under the file menu. Hovering over the menu items yields their function. The menubar looks like this: jupyter notebook cell menu: save, add, cut, copy, paste, move up, move down, run, stop, restart, restart+play, cell type

icon function
floppy disk save the notebook
plus sign insert cell below
scissors cut the selected cells
one dog eared paper on top of another copy the selected cells
dog eared paper on top of blank paper paste the selected cells
up arrow move selected cells up
down arrow move selected cells down
play button (triangle facing straight line) + word run execute code in cell
stop button (square) terminate execution of cell
rewind button (looping arrow) restart notebook
fast forward button (two arrows) restart notebook and execute all cells
drop down menu with variable options about cell type depending on what plugins are installed type of cell (e.g. code, markdown, raw, etc)

Jupyter notebook also provides a set of keyboard shortcuts for managing these cells. You can read more about them at http://jupyter-notebook.readthedocs.io/en/stable/examples/Notebook/Notebook%20Basics.html#Keyboard-Navigation