JupyterLab Guide#
Python 3 Notebook interface#
Basic Jupyter notebook manipulation#
A Jupyter notebook is comprised of cells. There are 3 types of cells: raw, code, and markdown. Most likely, you will interact mainly with code and markdown cells. Visually, a code cell is distinguished from the markdown cell by a gray background. A code cell is used to execute python codes, while a markdown cell is used to displaying richly-formatted texts.
In general, there are two modes of operation when working with a Jupyter notebook: the command mode and the edit mode. The former is for cell-level operations while the latter is for editing the content within a cell. If you see a flashing cursor in your notebook, you are likely in the edit mode. In addition, the current cell being edited is usually indicated by a tight blue line frame, whereas in command mode the blue frame extends all the way to the left.
A few operations that are useful in command mode:
mconverts the current cell into a markdown cellyconverts the current cell into a code cellainserts a cell above the current cellbinserts a cell below the current cellccopies the content of the current cell, andvpastes itd+ddeletes the current cellzundoes the previous cell-level action
Running code in Jupyter notebook#
Texts inside a code cell are intended to be executed as python code. To run the codes in the current cell, press Shift + Enter in either edit mode or command mode. You can also use the play button (⯈) on the top of the main panel to execute the current cell.
Importantly, the python backend (“kernel”) cares only about the order you execute the codes, not the order they are presented in the notebook. Thus, it can be useful to occasionally restart the kernel and rerun your codes sequentially. To restart the kernel, use the refresh button (⟳) on the top of the main panel. You may also find the restart and run all option (⏩) useful.
Markdown formatting#
In a markdown cell certain characters have special meaning. Some useful examples:
To create a list, start the line with a
+, followed by a spaceTo set a block of texts in boldface, surround the block with a pair of
**To italicize a block of texts, surround the block with a pair of
_To set a block of text in monospace, surround the block with a pair of
`To create headings, start the line with a sequence of
#, followed by a space (the more#the lower the heading in the hierarchy)
Terminal interface#
The Terminal interface basically brings up a linux Terminal. Thus, the usual linux commands all work as expected, including:
lsfor listing contents of a directorycdfor changing directorycpfor file copymvfor file movermfor file removalmkdirfor making new directory
A number of Linux programs are also installed in the environment. Notably,
gitfor Git version control (for more details, see the Git and GitHub Guide)aws s3for managing Amazon s3 bucket (for more details, see the Data/Code Storage Guide)