Unit 1: Python Programming – IIData Manipulation, Missing Values & Linear Regression
Equip yourself with the computational powerhouse behind modern Artificial Intelligence. Master multi-dimensional NumPy arrays, tabular analytics with Pandas (Series & DataFrames), real-world CSV import/export, data cleaning strategies (handling missing values with dropna and fillna), and predictive modeling with Linear Regression on real datasets.
1.1.1 The NumPy Library & Array Rank
NumPy (short for Numerical Python) is the core library for numerical computing in Python. It provides high-performance, multidimensional array objects (ndarray) and collections of routines for fast mathematical, logical, and statistical operations.
Creating a Rank 1 Array (1D)
In NumPy, the number of dimensions is formally termed the rank of the array.
import numpy as np
# Creating a rank 1 array from a Python list
arr = np.array([1, 2, 3])
print("Array with Rank 1:")
print(arr)
# Output: [1 2 3]
# Creating an array from a tuple
arr_tuple = np.array((1, 3, 2))
print("Array from tuple:", arr_tuple)
# Output: [1 3 2]Creating a Rank 2 Array (2D Matrix)
Rank 2 arrays contain rows and columns, serving as the mathematical backbone for image pixels and tabular matrices.
import numpy as np
# Creating a rank 2 array (2 rows, 3 columns)
arr2 = np.array([[1, 2, 3], [4, 5, 6]])
print("Array with Rank 2:")
print(arr2)
# Output:
# [[1 2 3]
# [4 5 6]]
# Statistical metrics using NumPy
print("Mean:", np.mean(arr2)) # 3.5
print("Std Dev:", np.std(arr2)) # 1.7078Next: Master Data Science Methodology
Move to Unit 2 (8 Marks Theory): The 10-step John B. Rollins framework, Model Validation, and Confusion Matrix calculations.