INTRODUCTION
TO POPULAR
PYTHON
LIBRARIES
NAME – ATHARVA PRATAP THAKUR
DIV – ‘A’ ROLL NO. – ‘38’
SUB - PYTHON
What are “ Python Libraries ” ?
Definition: A library in Python is a collection of
modules that allows for reusable code, providing
specific functionalities.
Purpose: They help reduce the need for writing code
from scratch, saving time and effort.
Example: Importing and using libraries in Python
with import statements.
Why use “ Python Libraries ” ?
Increased Productivity: Pre-built functions help
speed up development.
Modular Design: Libraries allow code to be modular
and easily reusable.
Community Support: Many libraries are actively
maintained and improved by the Python community.
Popular “ Python Libraries ”
Overview
NumPy: For numerical computations.
Pandas: For data manipulation and analysis.
Matplotlib: For data visualization.
Requests: For making HTTP requests.
TensorFlow: For machine learning and deep learning.
Scikit-learn: For machine learning algorithms.
NumPy – NUMERICAL COMPUTING
Purpose: Used for numerical operations, especially on
arrays.
Features:
1. Efficient multi-dimensional array handling.
2. Mathematical functions for linear algebra,
Fourier transforms, etc.
Example Code:
import numpy as np
arr = np.array([1, 2, 3])
print(arr + 5)
# Output: [6 7 8]
PANDAS – DATA MANIPULATION
Purpose: Used for data manipulation and analysis with data structures
like DataFrames.
Features:
1. Handling large datasets.
2. Data cleaning and preprocessing.
3. Data aggregation and analysis.
Example Code: #Output:
import pandas as pd Name
Age
data = {'Name’: [‘Atharva’, ‘Anushka’], 'Age’: [17, 18]} 0. Atharva
17
df = pd.DataFrame(data) 1.Anushka
18
print(df)
MatPlotlib – DATA VISUALISATION
Purpose: Used for creating static, animated, and
interactive plots.
Features:
1. Line charts, bar charts, histograms, etc.
2. Customization options for visualizations.
Example Code:
import matplotlib.pyplot as plt
x = [1, 2, 3, 4, 5]
y = [1, 4, 9, 16, 25]
plt.plot(x, y)
plt.show()
Requests – HTTP Requests
Purpose: Simplifies making HTTP requests (GET,
POST, etc.).
Features:
1. Easy to use for web scraping and APIs.
2. Handles various HTTP methods.
Example Code:
import requests
response = requests.get('https://api.github.com’)
print(response.json())
Output:
{
"current_user_url": "https://api.github.com/user",
"current_user_authorizations_html_url":
"https://github.com/settings/tokens", "authorizations_url":
"https://api.github.com/authorizations",
"repository_url": "https://api.github.com/repositories",
"user_url": "https://api.github.com/users/{user}",
"user_organizations_url": "https://api.github.com/users/{user}/orgs",
"meta":
{
"version": "2.0",
"description": "The GitHub API"
},
"rate_limit": { "limit": 5000, "remaining": 4999, "reset":
TenserFlow – MACHINE LEARNING
Purpose: A powerful library for deep learning and machine
learning.
Features:
1. Neural networks, model training, and deployment.
2. Used for complex applications like computer vision
and NLP.
Example Code:
import tensorflow as tf
model=tf.keras.Sequential([tf.keras.layers.Dense(10)])
model.compile(optimizer='adam', loss='mean_squared_error’)
model.summary()
#Output:
Model: "sequential“
____________________________________________________
Layer (type) Output Shape Param #
================================
====================
dense (Dense) (None, 10) 20
================================
====================
Total params: 20
Trainable params: 20
Non-trainable params: 0
____________________________________________________
Scikit-learn – MACHINE LEARNING
Purpose: Provides simple and efficient tools for data
mining and machine learning.
Features:
1. Algorithms for classification, regression,
clustering, and more.
2. Tools for model evaluation and selection.
Example Code:
from sklearn.ensemble import RandomForestClassifier
model = RandomForestClassifier(n_estimators=100)
Other Notable Python Libraries :-
Flask/Django: For web development.
BeautifulSoup: For web scraping.
PyTorch: For deep learning (alternative to TensorFlow).
OpenCV: For computer vision tasks.
SQLAlchemy: For database interaction.
Conclusion :-
Conclusion: Python libraries are essential tools for
efficient programming, offering a wide range of
functionalities.
Availability: Explore specific libraries based on the
project requirements (e.g., data science, web
development, etc.).
THANKYOU