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.
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.
To delete cells, first select them and you can either:
- select Edit -> Delete Cells in the Menu Bar
- press dd in Command Mode
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