Topics in this subject

16 topics

NumPy

0 of 16 complete 0%
01 2 min read

Introduction & Why NumPy

NumPy (Numerical Python) is the foundation of the entire Python scientific stack. Pandas, scikit-learn, TensorFlow, SciPy, and Matplotlib all sit on t

02 3 min read

Creating Arrays

The functions below are the workhorses for constructing arrays. Master these; they appear constantly.

03 1 min read

Array Attributes

Every attribute below is a cheap header read — no computation over the data.

04 1 min read

Data Types (dtypes)

NumPy dtypes control memory and precision.

05 2 min read

Indexing & Slicing

a = np.arange(10) # [0 1 2 3 4 5 6 7 8 9]

06 1 min read

Reshaping

a = np.arange(12)

07 2 min read

Broadcasting

Broadcasting lets NumPy operate on arrays of different shapes without copying data, by virtually stretching smaller arrays.

08 1 min read

Mathematical Operations

a = np.array([1, 2, 3]); b = np.array([4, 5, 6])

09 2 min read

Aggregations

axis=0 collapses rows (result has one value per column). axis=1 collapses columns (one value per row).

10 1 min read

Sorting & Searching

a = np.array([3, 1, 2])

11 1 min read

Combining & Splitting Arrays

a = np.array([[1, 2], [3, 4]])

12 1 min read

Linear Algebra

A = np.array([[1, 2], [3, 4]])

13 1 min read

Random Module

Modern NumPy uses the Generator API (np.random.defaultrng), which is preferred over legacy np.random..

14 1 min read

Performance Optimization

result = np.empty(len(a))

15 4 min read

NumPy Interview Questions (40+)

1. Why is NumPy faster than Python lists?

16 1 min read

NumPy Exercises

N1. Create a 3×3 array of numbers 1–9.