0% found this document useful (0 votes)
2 views6 pages

Python Libraries

All Python Libraries
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views6 pages

Python Libraries

All Python Libraries
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

1.

NumPy (Numerical Python)


📌 What is NumPy?

NumPy is a core Python library used for numerical computing. It provides support for multi-
dimensional arrays and fast mathematical operations.

🎯 Key Features

 N-dimensional array object (ndarray)


 Fast computations (implemented in C)
 Broadcasting (automatic expansion of arrays)
 Vectorization (no need for loops)
 Mathematical & statistical functions

🧠 Important Concepts

1. Array Creation

import numpy as np
a = [Link]([1, 2, 3])
b = [Link]((2,2))
c = [Link]((3,3))

2. Array Properties

 ndim → number of dimensions


 shape → size of array
 dtype → data type

3. Mathematical Operations

a+b
a*b
[Link](a)
[Link](a)

4. Broadcasting

Allows operations between arrays of different shapes.


5. Indexing & Slicing

a[0], a[1:3]

⚡ Advantages

 High performance
 Memory efficient
 Backbone for ML libraries

❗ Limitations

 Only supports homogeneous data


 Not suitable for labeled data

💡 Interview Tip

👉 “NumPy is mainly used for fast numerical computations and array operations, and it forms the
base of libraries like Pandas and SciPy.”

🔷 2. Pandas

📌 What is Pandas?

Pandas is used for data manipulation and analysis, especially with structured data like tables.

🎯 Key Features

 Data structures: Series and DataFrame


 Handles missing data
 Data cleaning & transformation
 File handling (CSV, Excel, SQL)

🧠 Important Concepts

1. Data Structures

🔹 Series (1D)
import pandas as pd
s = [Link]([1,2,3])

🔹 DataFrame (2D)

df = [Link]({
"Name": ["A", "B"],
"Age": [20, 25]
})

2. Data Operations

 Filtering:

df[df["Age"] > 20]

 Sorting:

df.sort_values("Age")

 Grouping:

[Link]("Name").sum()

3. Handling Missing Values

[Link](0)
[Link]()

4. File Handling

pd.read_csv("[Link]")
df.to_csv("[Link]")

⚡ Advantages

 Easy data manipulation


 Works well with real-world datasets
 Integration with NumPy

❗ Limitations

 Slower than NumPy for pure numerical tasks


 High memory usage for large datasets
💡 Interview Tip

👉 “Pandas is best for data cleaning, preprocessing, and analysis, especially tabular data.”

🔷 3. Matplotlib

📌 What is Matplotlib?

Matplotlib is a plotting library used for data visualization in Python.

🎯 Key Features

 Wide range of plots


 Customization (colors, labels, styles)
 Works with NumPy & Pandas

🧠 Important Concepts

1. Basic Plot

import [Link] as plt

x = [1,2,3]
y = [4,5,6]

[Link](x, y)
[Link]()

2. Types of Plots

 Line Plot
 Bar Chart
 Histogram
 Scatter Plot
 Pie Chart

3. Customization

[Link]("Graph")
[Link]("X-axis")
[Link]("Y-axis")
[Link]()

⚡ Advantages

 Highly customizable
 Good for static plots

❗ Limitations

 Complex syntax compared to modern libraries


 Less interactive

💡 Interview Tip

👉 “Matplotlib is used to visualize data trends and patterns through different types of plots.”

🔷 🔥 Combined Comparison (VERY IMPORTANT FOR INTERVIEW)

Feature NumPy Pandas Matplotlib


Purpose Numerical computing Data analysis Data visualization
Data Type Arrays Tables (DataFrame) Graphs
Speed Very fast Moderate Depends
Usage Math operations Data cleaning Plotting

🔷 🧩 Real-World Workflow (Interview Gold Answer ⭐)

👉 In real projects:

1. Use NumPy → for numerical operations


2. Use Pandas → for data cleaning & processing
3. Use Matplotlib → for visualization

🔷 🎤 Final Interview Summary (Best Answer)

👉 “NumPy, Pandas, and Matplotlib are essential Python libraries in data science.
NumPy handles numerical computations, Pandas is used for data manipulation and analysis, and
Matplotlib is used for data visualization. Together, they form a complete pipeline for working with
data.”
A (Item) B (Sales)

1 Apple 10

2 Banana 20

3 Apple 30

Goal: Find the average sales for "Apple".


Formula: =AVERAGEIF(A1:A3, "Apple", B1:B3)
Result:

(Calculation:

You might also like