Python numpy.dtype.subdtype()函数
numpy.dtype.subdtype()函数如果这个dtype描述了一个子数组,则返回Tuple(item_dtype, shape),否则返回None。
语法: numpy.dtype.subdtype(type)
type : [dtype] 输入的数据类型。
返回 : 如果这个dtype描述了一个子数组,则返回Tuple(item_dtype, shape),否则返回None。
代码#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
极客教程