Get started with Jupyter Notebook

4 min


Brief introduction

Jupyter Notebook is an interactive computing environment that enables users to write and execute code in a browser and interact with code results, text, images, videos, and more. Its flexibility, ease of use, and visualization make it the tool of choice for a wide range of data analysis, machine learning, and scientific computing tasks. This article will introduce the basic concepts of Jupyter Notebook, how to use it, and some common tips.

Installation and startup

Jupyter Notebook is based on Python, so you first need to make sure that Python is installed correctly. Then, enter the following command on the command line to install Jupyter Notebook:

Once the installation is complete, you can use the following command to start Jupyter Notebook:

bashCopy codejupyter lab

This automatically opens the default browser and displays the interface of Jupyter Notebook.

The basic structure of a notebook

A notebook file in Jupyter Notebook has a suffix and contains cells. Cells can be a code or text. Code cells let users write and run code. Users can type Python code and click Run or use a shortcut to see the output below the cell. Text cells let users write and show text, images, videos, and more. Users can format text with Markdown, math formulas, and HTML in text cells.​.ipynb​

Tips for use

shortcut key

Jupyter Notebook provides several shortcuts that can help users be more productive. Here are some commonly used shortcuts:

  • : Runs the current cell and jumps to the next cellShift + Enter
  • : Runs the current cell and stays in the current cellCtrl + Enter
  • : Run the current cell and insert a new cell belowAlt + Enter
  • : Enter command mode from edit mode Esc​
  • : Enter edit mode from command modeEnter
bashCopy codepip install jupyterlab

Import an external library

In Jupyter Notebook, you can directly import and use external libraries such as pandas, matplotlib, etc. You only need to use statements in code cells to import the library. Here’s an example of importing pandas and using it:​import​

pythonCopy codeimport pandas as pd
data = pd.read_csv('data.csv')

Save and share notebooks

Jupyter Notebook supports saving notebooks in different formats, including .ipynb (default),. .py. html, etc. Users can choose to save it as an .ipynb file for later editing and running in Jupyter Notebook or save it to another format for easy sharing. Click “File” in the interface – > “Save Notebook As” to select the format you want to save.

Insert code and text

In Jupyter Notebook, new cells can be inserted by clicking the “Insert” menu. The newly inserted cell defaults to a code cell, which can be converted to a text cell by toggling the cell type button. In text cells, you can use Markdown syntax to insert headings, lists, links, tables, etc. The following is an example using Markdown syntax:

# Title
**Bold Text**
- List item 1
- List item 2
[Link text](
| Column 1 | Column 2 |
|   1     |   2     |
|   3     |   4     |


Jupyter Notebook is a powerful, flexible, and easy-to-use interactive computing environment for a variety of data analysis, machine learning, and scientific computing tasks. This article provides the basic concepts of Jupyter Notebook, how to use it, and some common tips. I hope that readers can understand and start using Jupyter Notebook through this article and discover its value and convenience in work and study.

Sample code: Data analysis

Let’s say we have a CSV file of sales data that contains information such as sales dates, product names, and sales. We can use it for data analysis and visual presentation. Here is a sample code to read a CSV file and plot a line chart of sales:

# Import necessary libraries
import pandas as pd
import matplotlib.pyplot as plt

# Read the CSV file
data = pd.read_csv('sales_data.csv')

# Plot the sales data as a line chart
plt.plot(data['Date'], data['Sales'])
plt.title('Daily Sales Trends')

In the above code, we first read the CSV file using the library’s function and store the data in a variable. Then, we use the library’s functions to plot a line chart of sales. By setting properties such as, and so on, we can add titles and labels to the graphic. Finally, use the function to set the rotation angle of the x-axis label and display the graph through the function. This sample code helps us analyze and visualize data in Jupyter Notebook. By importing actual data into Jupyter and using appropriate libraries and methods, we can perform various data manipulations and analyses according to our needs, resulting in valuable conclusions about sales trends, product sales, and more.pandas​​ read_csv ​​data​​ matplotlibb plot​​xlabel​​ ylabel ​​title​​ xticks ​​show​

Jupyter Notebook is a very popular interactive development environment that combines code, text, and visualization and provides rich data analysis and visualization tools. Its advantages are ease of use, flexibility, interaction, and shareability.

Jupyter Notebook

However, It also has some disadvantages, mainly including the following aspects:

  1. Order of execution: Jupyter notebooks are executed sequentially in the order in which blocks of code are executed, not in the order from top to bottom of the entire document. This can lead to confusion and confusion, especially when executing some code that relies on the results of the previous code block.
  2. Version control: Jupyter Notebook files are saved in JSON format and contain information such as code, text, and output. This file format is not suitable for version control because each edit changes the structure of the entire file, making it difficult to differentiate and track versions.
  3. Maintainability: Code and text in Jupyter Notebooks are often mixed up, which makes the code less readable and maintainable. Especially when it comes to large-scale projects and team collaboration, Its code tends to become confusing and difficult to understand.
  4. Security: The default setting for Jupyter Notebook is to allow arbitrary code execution in the browser, which can lead to security risks. If an untrusted notebook file is run, it may lead to the execution of malicious code. In addition to Jupyter Notebook, there are other similar interactive development environments to choose from, including:
  5. Google Colab: Google Colab is a cloud-based development environment based on Jupyter Notebook, providing free GPU and TPU resources suitable for deep learning and machine learning tasks.
  6. PyCharm: PyCharm is a powerful professional Python development tool that provides rich features and plugins for large-scale projects and team development.
  7. Visual Studio Code: Visual Studio Code is a lightweight code editor that provides a wealth of extensions and debugging tools for the development of a variety of programming languages. These tools have their own advantages and applicability in different scenarios and needs, and can be selected and used according to specific projects and personal preferences.

Join Guidady AI Mail List

Subscribe to our mailing list and get interesting stuff and updates to your email inbox.

Thank you for subscribing.

Something went wrong.

Like it? Share with your friends!

64 shares, 1 point


Your email address will not be published. Required fields are marked *


I am an IT engineer, content creator, and proud father with a passion for innovation and excellence. In both my personal and professional life, I strive for excellence and am committed to finding innovative solutions to complex problems.
Choose A Format
Personality quiz
Series of questions that intends to reveal something about the personality
Trivia quiz
Series of questions with right and wrong answers that intends to check knowledge
Voting to make decisions or determine opinions
Formatted Text with Embeds and Visuals
The Classic Internet Listicles
The Classic Internet Countdowns
Open List
Submit your own item and vote up for the best submission
Ranked List
Upvote or downvote to decide the best list item
Upload your own images to make custom memes
Youtube and Vimeo Embeds
Soundcloud or Mixcloud Embeds
Photo or GIF
GIF format