The code
a = 100. * np.random.randn(200)
a = a.astype(int)
recasts a
as an array of integer numbers. Meanwhile, the code
a = 100. * np.random.randn(200)
a[:] = a.astype(int)
recasts a
as an array of integer floats obtained by truncating the original values of a
. Why doesn't the second case also give integers?
I'm currently using Python 3.8 and NumPy 1.23.