Convert np.array([1.9, 2.4, 3.7]) to integers by rounding — not truncating
NumPy · from dtypes, precision and casting
int8/16/32/64uint8float32/64overflow.astypepromotionnp.iinfonp.isclosePutting the kettle on…
Starting up…
Exercise 2
Convert np.array([1.9, 2.4, 3.7]) to integers by rounding — not truncating. You should get [2, 2, 4].
your answer
stuck? the lesson behind it
dtypes, precision and casting
Fixed-width boxes — and every surprise that follows from them.