0 / 34
Lesson 15

Column Broadcasting

Use shape (n,1) for column broadcast:

col = np.array([[10],[20]])
m * col  # each row ร— its scalar

.reshape(-1, 1) makes a column vector.

Why this matters

A plain 1D vector often broadcasts across rows (length matches columns). When you need one scalar per row, give the vector shape (n, 1) so NumPy aligns it down the column axis.

This shows up in per-row normalization, per-sample weights, and cleaning up accidental "row vs column" bugs.

ResourcesDocs, references & more โ€” opens in a new tab
๐ŸŽฏ Your Task

data = np.ones((3,4)), multipliers = [1,2,3]. Multiply each row. โ†’ result.

multipliers.reshape(-1, 1) * data
exercise.py
โŒ˜โŽ run ยท โŒ˜โ† โ†’ nav
โ–ถ Output
Run your code to see output here.