Essential Python Libraries
Two Python libraries are the backbone of almost all ML projects: NumPy for numerical arrays and Pandas for data tables. This chapter gives you just enough to get started.
NumPy – Numerical Arrays
import numpy as np
arr = np.array([1,2,3,4])
print(arr * 2) # [2,4,6,8] – element‑wise operation
print(arr.mean()) # 2.5NumPy arrays are fast and support vectorized operations (no loops). You will use them for model inputs and outputs.Pandas – DataFrames
import pandas as pd
df = pd.DataFrame({
"age": [25,30,35],
"income": [50000,60000,70000]
})
print(df.head())
print(df["age"].mean()) # 30.0Pandas DataFrames are like Excel tables – rows are samples, columns are features. You will load datasets and clean them with Pandas.Installation
pip install numpy pandasWhy These Libraries?
- NumPy provides the mathematical foundation (arrays, linear algebra).
- Pandas makes data loading, cleaning, and manipulation intuitive.
- Scikit-learn (later modules) works directly with NumPy arrays and Pandas DataFrames.
Two Minute Drill
- NumPy = fast numerical arrays, vectorized operations.
- Pandas = DataFrames for tabular data.
- Install both with
pip install numpy pandas. - Most ML workflows start with loading data into a Pandas DataFrame.
Need more clarification?
Drop us an email at career@quipoinfotech.com
