NumPy & Pandas Basics
Python · Intermediate
Definition
NumPy provides fast arrays; Pandas provides DataFrames for tabular data.
The standard toolkit for data science and machine learning.
Diagram
Flowchart
Example: Vectorized math
import numpy as np
a = np.array([1, 2, 3])
print(a * 2, a.mean())Output: [2 4 6] 2.0
Complexity
Vectorized ops run in C — far faster than Python loops
Key points
- Avoid row-by-row loops
- df.groupby().agg() summarizes groups
Interview questions
Why is NumPy fast?
Operations run in compiled C on contiguous typed memory.