How To Create Jupyter Notebook File

This article will tell you how to create Jupyter notebook file, what is the structure of the file and what content can you write in the file.

1. Create Jupyter Notebook File Steps.

  1. Click the New drop down list at jupyter notebook home page top right corner.
    jupyter notebook new menu item
  2. There are a list of menu item in the drop down list.
  3. If you click the Folder sub menu item, it will create a folder in current jupyter web server folder. You should rename the folder on the server side, and then the new folder name will be displayed in the web page.
  4. If you click the Python 3 sub menu item, it will open a new browser tab to show the new python 3 script editing window.
    jupyter notebook python 3 file editor window new
  5. The top area of this tab window is the file operation menu bar. You can Insert, Delete, Copy, Paste python code in this window.
  6. After you input the python source code in each line, if you click the run button, it will display the code execution result under the code line.

2. Jupyter Notebook File Structure Introduction.

Jupyter notebook file structure should follow below rules.

  1. A document consists of a series of cells, one cell one line.
  2. Each cell is a multiline text input box.
  3. Cell content can be executed by press shift + enter key, click the play button on the toolbar,  or the command in the cell menu on the menu bar.
    jupyter notebook execute cell content command menu
  4. The execution behavior of a cell is determined by the type of cell.
  5. There are four types of cells: code cell, markdown markup language text cell, title cell, and raw cell.
  6. When you insert a cell line, it original type is code. But you can change it’s type by click sub menu of Cell —> Cell Type menu.
    jupyter notebook cell menu - cell type to change the cell type

3. Jupyter Notebook Cell Type Introduction.

  1. Code Type: Allows you to edit and write new code with syntax highlighting and tab autocomplete. The programming language used depends on the kernel,  default kernel is python. When a code cell is executed, the code it contains is sent to the associated kernel, the kernel returns the result after calculation and displays the output after the corresponding cell. Output is not limited to text, there are many other possible forms of output, including Matplotlib diagrams, HTML, and so on.
  2. Markdown Type : Cell that can write markdown markup text.
  3. Raw Type : Used to write output directly. Notebook doesn ‘t do anything with it. It outputs whatever you edit.