numpy.ndarray.dtype()函数– Python
numpy.ndarray.dtype()
函数返回数组元素的数据类型。
Syntax : numpy.ndarray.dtype()
Parameters : None
Return : [numpy dtype object] Return the data-type of the array’s elements.
代码#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