代码示例:(标识:python_numpy_array_astype_1)
python_numpy_array_astype_1.py
import numpy as np

arr = np.array([1.1, 2.1, 3.1])

newarr = arr.astype('i')

print(newarr)
print(newarr.dtype)
运行结果: