numpy.dtype.subdtype() function – Python
Last Updated :
18 Jun, 2020
numpy.dtype.subdtype()
function returns Tuple(item_dtype, shape) if this dtype describes a sub-array, and None otherwise.
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.
Code #1 :
import numpy as geek
x = geek.dtype( '8f' )
gfg = x.subdtype
print (gfg)
|
Output :
(dtype('float32'), (8, ))
Code #2 :
import numpy as geek
x = geek.dtype( 'i2' )
gfg = x.subdtype
print (gfg)
|
Output :
None
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...