📜  numpy.ndarray.dtype()函数– Python

📅  最后修改于: 2022-05-13 01:55:45.254000             🧑  作者: Mango

numpy.ndarray.dtype()函数– Python

numpy.ndarray.dtype()函数返回数组元素的数据类型。

代码#1:

# Python program explaining
# numpy.ndarray.dtype() function
         
# importing numpy as geek 
import numpy as geek 
     
arr = geek.array([[0, 1], [2, 3]])
   
gfg = arr.dtype
   
print (gfg)

输出 :

int64


代码#2:

# Python program explaining
# numpy.ndarray.dtype() function
         
# importing numpy as geek 
import numpy as geek 
     
arr = geek.array([  0.,  1.,  2.])
   
gfg = arr.dtype
   
print (gfg)

输出 :

float64