What is Jupyter Notebook?
Jupyter Notebook is a free, open source web application for writing and sharing code package for Data Analytics, Data Science, Machine Learning and Deep Learning etc.
Launch Jupyter Notebook
You can start your Jupyter Notebook from Anaconda.
- On Mac: Browse to the folder where Anaconda is installed and select Anaconda Navigator. Once you have launched the navigator select Jupyter Notebook.
- On PC: Use windows search to search for Anaconda and then launch Anaconda Navigator.
- Using Terminal or Command Prompt:
- Start a terminal on Mac or Command prompt on a PC
- Enter the any folder where you would like to start Jupyter Notebook using cd command
- Now type jupyter notebook to launch the Jupyter Notebook App. The notebook will start in your browser.
Once jupyter notebook is launched, now you can create a new file by going to New menu and selecting your latest version of Python under notebook. In example below, we will select Python 3
This will launch a new notebook for us.
To familiarise with the interface, let’s go to Help menu and select User Interface Tour
Cells in Jupyter Notebook
We can type our python code in cells. Cells can be used for typing and running code or just for plaint text and Markdown.
In example below, we have typed a simple 1+1 and then use the Run option to see the result
In example below, we are running a basic for loop using Python
A cell can be converted to Markdown for writing plain text or Markdown. To do this, select the cell then go to Cell Menu -> Cell Type -> Markdown
In example below, we are using Markdown (a lightweight markup language)
Shortcut Keys in Jupyter Notebook
Some of useful shortcut keys in Jupyter Notebook are:
- To insert a new cell after, select a cell and press a key on keyboard
- To insert a new cell before, select a cell and press b key on keyboard
- To cut a new cell before, select a cell and press x key on keyboard
- To run a code, press Ctrl key with Enter key. This will run the code in selected cell and add a new cell.
To find more about shortcut keys, browse to Help menu and select Keyboard Shortcuts.