Add [10, 20, 30] down the rows of np.zeros((3, 4), dtype=np.int64) — so row 0 g…

NumPy · from Adding, removing and moving axes

np.newaxisnp.expand_dims.squeeze()np.swapaxesnp.moveaxis.transpose(axes)

Putting the kettle on…

Starting up…

Exercise 3

Add [10, 20, 30] down the rows of np.zeros((3, 4), dtype=np.int64) — so row 0 gains 10, row 1 gains 20, row 2 gains 30.

your answer
stuck? the lesson behind it
Adding, removing and moving axes
newaxis, squeeze, moveaxis — the tools for making shapes line up.