Getting started with Jupyter Notebook | Python
Last Updated :
11 Jul, 2024
The Jupyter Notebook is an open-source web application that allows you to create and share documents that contain live code, equations, visualizations, and narrative text. Jupyter has support for over 40 different programming languages and Python is one of them. Python is a requirement (Python 3.3 or greater, or Python 2.7) for installing the Jupyter Notebook itself. Jupyter Notebook can be installed by using either of the two ways described below:
Install Jupyter Notebook with Anaconda
Install Python and Jupyter using the Anaconda Distribution, which includes Python, the Jupyter Notebook, and other commonly used packages for scientific computing and data science. To install Anaconda, go through How to install Anaconda on Windows. and follow the instructions provided.
Install Jupyter Notebook using PIP
Install Jupyter using the PIP package manager used to install and manage software packages/libraries written in Python. To install pip, go through How to install PIP on Windows. and follow the instructions provided.
Getting Started With Jupyter Notebook for Python
Command to Launch Jupyter Notebook
jupyter notebook
This will start up Jupyter and your default browser should start (or open a new tab) to the following URL:Â http://localhost:8888/tree
.png)
When the notebook opens in your browser, you will see the Notebook Dashboard, which will show a list of the notebooks, files, and subdirectories in the directory where the notebook server was started. Most of the time, you will wish to start a notebook server in the highest level directory containing notebooks. Often this will be your home directory.

Creating a Jupyter Notebook
Now on the dashboard, you can see a new button at the top right corner. Click it to open a drop-down list and then if you’ll click on Python3, it will open a new notebook.


Renaming Jupyter Notebooks
We can notice that at the top of the page is the word Untitled. This is the title for the page and the name of your Notebook. We can change the name by simply clicking on it.

Run and Debug Jupyter Notebook Code Cell
Letâs try adding the following code to that cell:
Running a cell means that we want to execute the cellâs contents. To execute a cell, you can just select the cell and click the Run button that is in the row of buttons along the top. Itâs towards the middle.

Jupyter Notebook Menu Items
Jupyter Notebook contains a list of menus which can be used to perform various functions.
- File: The “File” menu in Jupyter Notebook allows you to perform actions like creating and opening notebooks, saving your work, exporting notebooks in different formats, managing checkpoints, and closing notebooks.
- Edit: The “Edit” menu in Jupyter Notebook provides various editing options for the cells within your notebook. You can cut, copy, paste, delete, merge, split, and manipulate cells using these edit functions.
- View:The “View” menu in Jupyter Notebook provides options to control the appearance and layout of your notebook interface, allowing you to customize its display to your preferences and needs.
- Insert: The “Insert” menu in Jupyter Notebook contains options for adding new cells and other elements to your notebook, allowing you to insert code, text, or various types of content into your document.
- Cell: The “Cell” menu in Jupyter Notebook provides options for manipulating individual cells within your notebook. You can use it to run, delete, and modify cells, as well as change their cell type (e.g., code or markdown). This menu is essential for cell-level operations in your notebook.
- Kernel: The Kernel menu allows you to interrupt or restart the computation process, reconnect to a kernel, and change the kernel (i.e., the programming language and environment) for your notebook. Itâs crucial for managing the execution state of a Jupyter Notebook.
- Widgets: The “Widgets” menu in Jupyter Notebook is used for working with interactive widgets, which are graphical elements that enhance the interactivity and user experience of your notebook. You can use this menu to create, display, and interact with widgets like buttons, sliders, text boxes, and more.
- Help: The “Help” menu in Jupyter Notebook offers documentation and resources to assist users in understanding and using Jupyter Notebook effectively.
Open a Terminal in Jupyter
To open terminal go to the homepage and click on new and then select terminal from the drop down list.

Viewing Whatâs Running
The home page of your Jupyter server (http://localhost:8888/tree) has two other tabs: Running and Clusters. The Running tab will tell us which Notebooks and Terminals we are currently running. This is useful for when you want to shut down your server but you need to make sure that you have saved all your data.Â

Adding Rich Content in Jupyter Notebook
In Jupyter Notebook, we can add rich content to your notebooks to enhance their interactivity and visual appeal. Rich content includes text, images, LaTeX equations, HTML, and multimedia elements like audio and video. This capability makes Jupyter Notebook a versatile tool for data analysis, research, and education.
Types of Cells in Jupyter Notebook
Jupyter Notebook provides several cell types, each with its own purpose and functionality. These cell types enable you to create, edit, and organize your content within a notebook. Here are the main cell types in Jupyter.
- Code Cells: Code cells are used to write and execute code. You can enter programming code in various languages, such as Python, Julia, or R, and execute it within the notebook. The output of the code is displayed below the cell. To run a code cell, press Shift + Enter or click the “Run” button in the toolbar.
- Markdown Cells: Markdown cells contain formatted text using Markdown syntax. You can create headings, lists, tables, and links, making it suitable for documentation and explanations. To render the Markdown content, press Shift + Enter.
- Raw Cells: Raw cells are used to include unprocessed, raw content. The content is not evaluated, formatted, or executed. Raw cells are typically used for including content like LaTeX equations.
- Heading Cells: Heading cells are a type of markdown cell that is used to structure your notebook. They create section headings and subheadings, which are helpful for organizing your content.
- Raw NBConvert Cells: These are similar to raw cells but are intended for content that will be converted into other formats when the notebook is exported.
Exporting the Jupyter Notebook
In Jupyter Notebook, we can export our notebooks in various formats to share with other people. Here’s how we can export notebooks. The formats available are:
- HTML
- LaTeX
- PDF
- RevealJS
- Markdown
- ReStructured Text
- Executable script
Converting Notebooks to other Formats
The nbconvert is a utility that comes with the Jupyter ecosystem, and it’s used for converting Jupyter Notebook files (.ipynb) to other formats like HTML, PDF, LaTeX, Markdown, and more. It allows you to share your Jupyter Notebook content in various document formats, making it more accessible and easier to distribute to others.
Jupyter Notebooks as PDF
We can use nbconvert to create PDFs from your notebooks, which is useful for creating reports or presentations from your Jupyter Notebook content.
samplefile

To convert it into pdf we use the command
jupyter nbconvert untitled1.ipynb --to pdf
After running the command a pdf file is saved in the folder after getting converting from the Notebook.

Coverting notebook to pdf
Useful Commands in Jupyter Notebook
Command to open a notebook in the currently running notebook server.
jupyter notebook notebook_name.ipynb
By default, the notebook server starts on port 8888. If port 8888 is unavailable or in use, the notebook server searches the next available port. You may also specify a port manually. In this example, we set the serverâs port to 9999:
jupyter notebook --port 9999
Command to start the notebook server without opening a web browser:
jupyter notebook --no-browser
The notebook server provides help messages for other command line arguments using the –help flag:
jupyter notebook --help
Jupyter Notebook Shortcuts
To change modes(edit, command):
Esc - Change mode to command mode
Enter - Change mode to edit mode
To change content type(code or markdown) [in command mode]
m - Change to markdown
y - Change to code
To execute code or markdown [any mode]
Shift + Enter - Execute and go to next cell
Ctrl + Enter - Execute and be in the same cell
To insert cell [in command mode]
a - Create cell in above to the cell
b - Create cell in below to the cell
To cut copy paste [in command mode]
x - Cut the cell that can be paste anywhere any number of times
c - Copy the cell that can be paste anywhere and any number of times
v - Paste the cell
Related Article: How to upload a dataset in Jupyter Notebook?
Similar Reads
Image processing with Scikit-image in Python
scikit-image is an image processing Python package that works with NumPy arrays which is a collection of algorithms for image processing. Let's discuss how to deal with images in set of information and its application in the real world. Important features of scikit-image : Simple and efficient tools
2 min read
Feature detection and matching with OpenCV-Python
In this article, we are going to see about feature detection in computer vision with OpenCV in Python. Feature detection is the process of checking the important features of the image in this case features of the image can be edges, corners, ridges, and blobs in the images. In OpenCV, there are a nu
5 min read
Python OpenCV - Roberts Edge Detection
Edge detection refers to a set of mathematical techniques for recognizing points in a digital image where the image brightness abruptly changes or, more formally, where there are discontinuities. The sharp fluctuations in image brightness are usually grouped into a collection of curved line segments
3 min read
Template matching using OpenCV in Python
Template matching is a technique for finding areas of an image that are similar to a patch (template). A patch is a small image with certain features. The goal of template matching is to find the patch/template in an image. To find it, the user has to give two input images: Source Image (S) - The im
6 min read
Image Steganography using OpenCV in Python
Image Steganography is the process of hiding secret data in some image. In this post, we will hide one image inside another and convert it into another image and then extract back both the images from the previous image. The idea behind image-based Steganography is very simple. Images are composed o
3 min read
Watermarking images with OpenCV and Python
In this article, we are going to see how to make watermarking images using OpenCV in Python. Watermark is intentionally left Text/Logo onto the image. Watermarks are generally used by artists to protect the copyright of the image. Using watermarks we can ensure that the owner of the image is the per
4 min read
Python | Intensity Transformation Operations on Images
Intensity transformations are applied on images for contrast manipulation or image thresholding. These are in the spatial domain, i.e. they are performed directly on the pixels of the image at hand, as opposed to being performed on the Fourier transform of the image. The following are commonly used
5 min read
Image Transformations using OpenCV in Python
In this tutorial, we are going to learn Image Transformation using the OpenCV module in Python. What is Image Transformation? Image Transformation involves the transformation of image data in order to retrieve information from the image or preprocess the image for further usage. In this tutorial we
5 min read
Reading images in Python
Python supports very powerful tools when comes to image processing. Let's see how to process the images using different libraries like ImageIO, OpenCV, Matplotlib, PIL, etc. Using ImageIO : Imageio is a Python library that provides an easy interface to read and write a wide range of image data, incl
3 min read
Python - Edge Detection using Pillow
Edge Detection, is an Image Processing discipline that incorporates mathematics methods to find edges in a Digital Image. Edge Detection internally works by running a filter/Kernel over a Digital Image, which detects discontinuities in Image regions like stark changes in brightness/Intensity value o
5 min read
White and black dot detection using OpenCV | Python
Image processing using Python is one of the hottest topics in today's world. But image processing is a bit complex and beginners get bored in their first approach. So in this article, we have a very basic image processing python program to count black dots in white surface and white dots in the blac
4 min read
Python Pillow - Creating a Watermark
In this article, we will see how the creation of a watermark is done using the Pillow library in Python. Pillow is a Python Image Library(PIL) that is used for manipulating images and working on the different formats of images like ('jpeg', 'png', 'gif', 'tiff' etc.). There are various image process
5 min read
Python PIL | paste() and rotate() method
PIL is the Python Imaging Library which provides the python interpreter with image editing capabilities. PIL.Image.Image.paste() method is used to paste an image on another image. This is where the new() method comes in handy. Syntax: PIL.Image.Image.paste(image_1, image_2, box=None, mask=None) OR i
2 min read
Image Feature Extraction Using Python
An essential method in computer vision and image processing is picture feature extraction. It entails locating and removing different characteristics or patterns from an image in order to make analysis and comprehension easier. These characteristics, which are essential for tasks like object detecti
9 min read
Image Super-Resolution with ESRGAN using PyTorch
Image Super-Resolution (ISR) involves improving the quality of images by increasing their resolution, creating superior images from lower resolution versions. ESRGAN, an advanced model for super-resolution tasks, is renowned for producing lifelike high-resolution images and maintaining crucial detai
9 min read
Create a vignette filter using Python - OpenCV
In general, Images in computers are stored in the form of a matrix. In case of color image, Image is represented in the form of 3-dimensional matrix or one can say that we use three 2d matrices for representing three color channels one 2d matrix for representing red channel, one for green and one fo
4 min read
Convert PNG to JPG using Python
PNG and JPG formats are used for image illustrations. Both the formats are used to provide good compatibilities with certain types of images like PNG works better with line drawings and icon graphics whereas JPG works well with photographs. However, both are interconvertible with respect to each oth
3 min read
How to Set Transparency with Linear Gradient in CSS ?
In web design, colors, and gradients play a vital role in crafting visually appealing websites. Incorporating transparency into specific elements can further enhance their visual impact. We'll explore three methods for achieving transparency with linear gradients in CSS including, background image,
3 min read
Spot the difference between two images using Python
In this article, we will discuss how to spot differences between two given images using python. In order to perform this task, we will be using the ImageChops.difference() method in Pillow module. Syntax: ImageChops.difference(image1, image2) Parameters: image1 first imageimage2 second image Return
2 min read