ndarray的数据类型

ndarray对象(即 NumPy数组)中的元素类型可以一致,也可以不一致。
但是如果我们在创建 ndarray对象时使用了 dtype 参数,则数组对象元素类型必须一致,否则报错
ndarray的数据类型

f=np.array(range(5),dtype=np.int64)
print(f)
print(f.dtype)
f_float=f.astype(np.float64)
print(f_float)
print(f_float.dtype)