python的dtype可用对象有哪些?
发布时间:2025-12-11 16:47:22

dtype() 返回数据元素的数据类型(int、float等)
type() 返回数据结构类型(list、dict、numpy.ndarray 等)
astype() 改变np.所有数据元素在array中的数据类型。
dtype()可以使用 才能用 astype()。
由于 list、dict dtype()函数可以包含不同的数据类型,因此不能调用,但其他类型可以调用dtype。
示例:
a=np.array(0.2132、1.032123、2.00212) a.dtype
运行结果:
dtype('float64')
更多Python知识,请关注:Python自学网!!
下一篇 python倒排列是什么意思
