numpy.dtype.subdtype()函数– Python
numpy.dtype.subdtype()
) 如果此 dtype 描述子数组,则函数返回 Tuple(item_dtype, shape),否则返回 None。
Syntax : numpy.dtype.subdtype(type)
type : [dtype] The input data-type.
Return : Return Tuple(item_dtype, shape) if this dtype describes a sub-array, and None otherwise.
代码#1:
# Python program explaining
# numpy.dtype.subdtype() function
# importing numpy as geek
import numpy as geek
x = geek.dtype('8f')
gfg = x.subdtype
print (gfg)
输出 :
(dtype('float32'), (8, ))
代码#2:
# Python program explaining
# numpy.dtype.subdtype() function
# importing numpy as geek
import numpy as geek
x = geek.dtype('i2')
gfg = x.subdtype
print (gfg)
输出 :
None