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.
- Click the New drop down list at jupyter notebook home page top right corner.
- There are a list of menu item in the drop down list.
- 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.
- 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.
- The top area of this tab window is the file operation menu bar. You can Insert, Delete, Copy, Paste python code in this window.
- 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.
- A document consists of a series of cells, one cell one line.
- Each cell is a multiline text input box.
- 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.
- The execution behavior of a cell is determined by the type of cell.
- There are four types of cells: code cell, markdown markup language text cell, title cell, and raw cell.
- 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.
3. Jupyter Notebook Cell Type Introduction.
- 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.
- Markdown Type : Cell that can write markdown markup text.
- Raw Type : Used to write output directly. Notebook doesn ‘t do anything with it. It outputs whatever you edit.