python

当前位置:中华考试网 >> python >> python编程基础 >> 文章内容

python的dtype可用对象有哪些?

来源:中华考试网  [2020年9月24日]  【
   python的dtype可用对象有哪些?

  dtype() 返回数据元素的数据类型(int、float等)

  type() 返回数据结构类型(list、dict、numpy.ndarray 等)

  astype() 改变np.array中所有数据元素的数据类型。

  能用dtype() 才能用 astype()。

  由于 list、dict 等可以包含不同的数据类型,因此不可调用dtype()函数,但是其他类型都可以调用dtype。

  运行结果:

  dtype('float64')

责编:hym
  • 会计考试
  • 建筑工程
  • 职业资格
  • 医药考试
  • 外语考试
  • 学历考试