Jupyter Notebook

What is Jupyter Notebook ?


The Jupyter Notebook is an open-source web application that allows to create and share documents that contain live code, equations, visualizations and narrative text. Uses include:

It excels in a form of programming called “literate programming” that allows users to formulate and describe their thoughts with prose, supplemented by mathematical equations, as they prepare to write code blocks. This mindset is the opposite of how we usually think about code.

Jupyter Notebook Basics


Launch Jupyter Notebook

Type jupyter-notebook in the Anaconda prompt window. The command will launch the jupyter-notebook in default web browser (as shown below). It has some cool features and we will be using it as our main development environment.

Launch Jupyter Notebook

Open a new Jupyter Notebook

Click New > Python 3 to open a new jupyter notebook. If you have multiple notebook environments, choose the one in which you want the notebook to run. A newly opened jupyter notebook looks something like below.

You will immediately see the notebook name, a menu bar, a toolbar and an empty code cell.

Launch Jupyter Notebook

Rename Jupyter Notebook Title

Click File > Rename to rename the notebook name/ title.

Rename Jupyter Notebook Jupyter Notebook with new name

Notebook Dashboard

Jupyter notebooks ends with an .ipynb extension. The notebooks that are currently running will be highlighted in green. The dashboard is mainly used to open notebooks and to manage them (e.g. shutdown, visualise).

Files in Localhost tree

Running our first Python code in a cell

We can create & run multiple cells inside the notebook. To run the cell, select Cell > Run Cells. Keyboard shortcut is Ctrl + Enter. You will see the output below the currently executed cell.

Files in Localhost tree

Insert a new cell

To insert a new cell below, select Insert > Insert Cell Below. Keyboard shortcut is Esc > B.

Delete a cell

To delete a cell, select Edit > Delete Cells. Keyboard shortcut is Esc > D > D.

Save the notebook

To save the notenook, select File > Save & Checkpoint. Keyboard shortcut is Ctrl + S.

Close the notebook

To close the notenook, select File > Close and Halt.


« Previous: Anaconda Next: Python Refresher »