import numpy as np
# create a float (32 bits) array
x = np.array([1.0, 2.0, 3.0], dtype=np.float32)
# convert to an integer (32 bits) array in place
x = x.astype('int32')
print(x.dtype)  
print(x)  # output: [1 2 3]