Return scores with every mark below 60 replaced by 0, keeping the (2, 3) shape
NumPy · from where, select and clip
np.wherenp.selectnp.clipnp.nonzeroa[mask] = xnp.putmaskPutting the kettle on…
Starting up…
Exercise 1
Return scores with every mark below 60 replaced by 0, keeping the (2, 3) shape.
your answer
stuck? the lesson behind it
where, select and clip
An if-statement over a whole array, without losing its shape.