List Operations
Indexing: Accesselements
by position (starts at 0).
Example:
◦ fruits = ["apple",
"banana", "cherry"]
◦ print(fruits[1])
◦ fruits.append("date")
◦ print(fruits)
Example:
fruits = ["apple", "banana", "cherry"]
print(fruits[1]) # banana
fruits.append("date") # add at end
print(fruits)
fruits.insert(0, "orange") # add at first position
print(fruits)
NumPy – Definition
NumPy(Numerical Python) is a Python library used for numerical and
mathematical operations.
It provides fast, memory-efficient array processing.
7.
Why NumPy isImportant
• Faster than Python lists
• Handles large datasets efficiently
• Core library for Data Analytics & ML
8.
Installing NumPy &Import
Command to install NumPy:
◦ "pip install numpy"
Import NumPy using alias:
import numpy as np
9.
What is NumPyArray?
A NumPy array is a collection of elements of the same data type.
It is stored in contiguous memory locations.
Example:
import numpy as np
arr = np.array([1, 2, 3])
print(arr * 2)
10.
1D Array –Code Example
import numpy as np
a = np.array([10, 20, 30, 40])
print(a)
11.
2D Array –Code Example
a = np.array([[1,2,3],[4,5,6]])
print(a)
Pandas – Definition
Pandasis a Python library used for data manipulation and analysis.
It works with structured data like tables.
adds data structures and tools designed to work with table-like data
(similar to Series and Data Frames in R)
provides tools for data manipulation: reshaping, merging, sorting,
slicing, aggregation etc.
allows handling missing data
15.
Why Pandas?
• Easydata cleaning
• Fast analysis
• Works with Excel, CSV, SQL