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
โโ run ยท โโ โ nav
โถ Output
Run your code to see output here.