NumPy challenges
Arrays, shapes and broadcasting — the layer everything else is built on.
104 exercises
1. Foundations
2. Indexing & selection
Indexing and slicinglesson 5
Views, copies and shared memorylesson 6
Boolean maskslesson 7
Fancy indexinglesson 8
3. Shape
Reshaping and transposinglesson 10
Adding, removing and moving axeslesson 11
Joining and splitting arrayslesson 12
4. Computation
Vectorisation and ufuncslesson 14
Aggregation and the axis argumentlesson 15
Running totals and differenceslesson 16
Sorting and searchinglesson 17
5. Numerics
6. In practice
Coordinate gridslesson 23
Making it fastlesson 24
7. Capstones
- How many readings are missing1
- Return the city codes for only the readings that actually arrived — same mask a…2
- Return the mean temperature per city as a 3-element array, ignoring missing rea…3
- Return the city names ordered warmest first4
- Return the 5th, 50th and 95th percentiles of the readings that arrived, as one…5
- Shift grid one row upwards, wrapping around, using np.roll1
- Build the neighbour count array for grid — the sum of all eight shifted copies2
- Given that count, apply the rules and return the next generation as a uint8 arr…3
- Run the simulation for 10 generations from grid and return how many cells are a…4