Python numpy.ndarray.dtype()函数
numpy.ndarray.dtype()函数返回数组元素的数据类型。
语法: numpy.ndarray.dtype()
参数:无
返回: [numpy dtype object] 返回数组元素的数据类型。
代码#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