Install Python Package | Jupyter Notebook Tutorial (2026) | Step-by-Step Guide
Install Python Package | Jupyter Notebook Tutorial (2026) | Step-by-Step Guide¶
Below is a Step-by-Step Guide on How to Install and work with Python Packages numpy, pandas, matplotlib in Jupyter Notebook:
numpy: Fundamental package for array computing in Python.
pandas: Powerful data structures for data analysis, data manipulation, time series, and statistics.
matplotlib: Python plotting package for creating charts and graphs.
(Run each cell by pressing Shift + Enter)
1. Install Packages¶
📌Check if package numpy, pandas and matplotlib is installed using command:
%pip show numpy pandas matplotlib
Note: you may need to restart the kernel to use updated packages.
WARNING: Package(s) not found: matplotlib, numpy, pandas
📌Install package numpy:
%pip install numpy
Collecting numpy Using cached numpy-2.5.4-cp314-cp314-win_amd64.whl.metadata (6.6 kB) Using cached numpy-2.5.4-cp314-cp314-win_amd64.whl (12.7 MB) Installing collected packages: numpy Successfully installed numpy-2.5.4 Note: you may need to restart the kernel to use updated packages.
📌Install both packages pandas and matplotlib:
%pip install pandas matplotlib
📌Jupyter will download and install the package. Wait until the installation process finishes.
📌Check if package numpy, pandas and matplotlib is installed successfully using command:
%pip show numpy pandas matplotlib
2. Install Package of a Specific Version¶
📌If your project requires a particular version of a package, specify the version number:
%pip install pandas==3.0.2
Collecting pandas==3.0.2
Using cached pandas-3.0.2-cp314-cp314-win_amd64.whl.metadata (19 kB)
Requirement already satisfied: numpy>=2.3.3 in C:\Users\schol\miniconda3\envs\jn\Lib\site-packages (from pandas==3.0.2) (2.5.4)
Requirement already satisfied: python-dateutil>=2.8.2 in C:\Users\schol\miniconda3\envs\jn\Lib\site-packages (from pandas==3.0.2) (2.9.0.post0)
Requirement already satisfied: tzdata in C:\Users\schol\miniconda3\envs\jn\Lib\site-packages (from pandas==3.0.2) (2026.2)
Requirement already satisfied: six>=1.5 in C:\Users\schol\miniconda3\envs\jn\Lib\site-packages (from python-dateutil>=2.8.2->pandas==3.0.2) (1.17.0)
Using cached pandas-3.0.2-cp314-cp314-win_amd64.whl (9.9 MB)
Installing collected packages: pandas
Attempting uninstall: pandas
Found existing installation: pandas 3.0.6
Uninstalling pandas-3.0.6:
Successfully uninstalled pandas-3.0.6
Successfully installed pandas-3.0.2
Note: you may need to restart the kernel to use updated packages.
%pip show pandas
📌To upgrade an existing package to a newer available version:
%pip install --upgrade pandas
Requirement already satisfied: pandas in C:\Users\schol\miniconda3\envs\jn\Lib\site-packages (3.0.2)
Collecting pandas
Using cached pandas-3.0.6-cp314-cp314-win_amd64.whl.metadata (19 kB)
Requirement already satisfied: numpy>=2.3.3 in C:\Users\schol\miniconda3\envs\jn\Lib\site-packages (from pandas) (2.5.4)
Requirement already satisfied: python-dateutil>=2.8.2 in C:\Users\schol\miniconda3\envs\jn\Lib\site-packages (from pandas) (2.9.0.post0)
Requirement already satisfied: tzdata in C:\Users\schol\miniconda3\envs\jn\Lib\site-packages (from pandas) (2026.2)
Requirement already satisfied: six>=1.5 in C:\Users\schol\miniconda3\envs\jn\Lib\site-packages (from python-dateutil>=2.8.2->pandas) (1.17.0)
Using cached pandas-3.0.6-cp314-cp314-win_amd64.whl (9.8 MB)
Installing collected packages: pandas
Attempting uninstall: pandas
Found existing installation: pandas 3.0.2
Uninstalling pandas-3.0.2:
Successfully uninstalled pandas-3.0.2
Successfully installed pandas-3.0.6
Note: you may need to restart the kernel to use updated packages.
%pip show pandas
3. Import Packages and Test¶
📌Import Packages and Test it using below command:
import numpy as np
import pandas as pd
print(np.__version__)
print(pd.__version__)
2.5.4 3.0.6
📌If a version number appears without an error, the package is installed and working.
4. Extracting Data from a CSV File Using Pandas¶
📌Create a csv file TestFile.csv
📌The below example code reads the CSV file and displays its contents.
data = pd.read_csv("TestFile.csv")
data.head()
| Product_ID | Product_Name | Category | Price | Quantity | Total | |
|---|---|---|---|---|---|---|
| 0 | 101 | Laptop | Electronics | 55000 | 2 | 110000 |
| 1 | 102 | Mouse | Accessories | 750 | 5 | 3750 |
| 2 | 103 | Keyboard | Accessories | 1500 | 3 | 4500 |
📌pd.read_csv("TestFile.csv") → Reads the CSV file and returns its contents as a DataFrame.
data → variable that stores the Pandas DataFrame.
data.head() → Displays the first five rows of the DataFrame.
5. Visualizing Data Using Matplotlib¶
📌The below example code creates and displays a line graph:
import matplotlib.pyplot as plt
plt.plot([1,2,3],[4,5,6])
plt.show()
📌pyplot is a module inside Matplotlib which is imported.
📌The plot() function takes two lists and creates a line graph:
First list [1, 2, 3] represents the X-axis values.
Second list [4, 5, 6] represents the Y-axis values.
📌The show() function displays the graph.
📌This code draws a line graph connecting the points (1, 4), (2, 5), and (3, 6).
Comments
Post a Comment