UNDERSTANDING PYTHON LIBRARIES
Python is one of the most popular programming languages in the world. One big reason is its amazing libraries. Libraries help us do big tasks with less code. In this blog, I will explain four popular Python libraries in a simple and easy way.
1. NumPy
NumPy stands for Numerical Python. It is mainly used for working with numbers and arrays.
If you are doing math, statistics, or data science, NumPy is very helpful.
Why NumPy is useful?
- It works faster than normal Python lists.
- It supports multi-dimensional arrays.
- It has many built-in math functions.
Example:
import numpy as np
arr = np.array([1, 2, 3, 4])
print(arr * 2)Output:
[2 4 6 8]Where NumPy is used?
- Data Science
- Machine Learning
- Scientific research
- Engineering calculations
In short, if your project has numbers and calculations, NumPy is a must.
2. Pandas
Pandas is used for data analysis and data handling. It works very well with tables like Excel sheets.
The main object in Pandas is a DataFrame. It looks like a table with rows and columns.
Why Pandas is useful?
- Easy to read CSV and Excel files.
- Easy to filter and clean data.
- Good for data analysis.
Example:
import pandas as pd
data = {
"Name": ["Aman", "Riya"],
"Marks": [85, 90]
}
df = pd.DataFrame(data)
print(df)Where Pandas is used?
- Data Analysis
- Data Cleaning
- Business reports
- Machine Learning projects
If you want to work with data, Pandas makes life easy.
3. Matplotlib
Matplotlib is used for data visualization. It helps us create graphs and charts.
Get Siddhi Sharma’s stories in your inbox
Join Medium for free to get updates from this writer.
With this library, we can create:
- Line graphs
- Bar charts
- Pie charts
- Histograms
Example:
import matplotlib.pyplot as plt
x = [1, 2, 3, 4]
y = [10, 20, 25, 30]
plt.plot(x, y)
plt.show()This code will create a simple line graph.
Why Matplotlib is useful?
- Easy to understand graphs.
- Good for reports and presentations.
- Works well with NumPy and Pandas.
If you want to show your data visually, this library is very helpful.
4. Tkinter
Tkinter is used to create GUI (Graphical User Interface) applications. It comes built-in with Python.
With Tkinter, you can create:
- Windows
- Buttons
- Labels
- Input boxes
Example:
import tkinter as tk
root = tk.Tk()
root.title("My App")
label = tk.Label(root, text="Hello World")
label.pack()
root.mainloop()This code creates a simple window with a text label.
Where Tkinter is used?
- Desktop apps
- Small tools
- Simple software projects
If you want to make a basic app with buttons and windows, Tkinter is a good start.
Conclusion
Python libraries make coding easy and fast.
- NumPy is best for numbers.
- Pandas is best for data tables.
- Matplotlib is best for graphs.
- Tkinter is best for GUI apps.








