I have got an array of floats
and I would like to cast it into int
.
a1 = np.ones(10)
a2 = a1.astype(int, copy=False)
a2.dtype # int
a1.dtype # float
What's going on here? I thought astype(int, copy=False)
would cast types in-places. But it doesn't appear to do so?
related question: In-place type conversion of a NumPy array