Python| numpy.issubdtype()函数
numpy.issubdtype()
函数用于确定第一个参数是否是第二个参数在类型层次结构中较低/相等的类型代码。如果第一个参数较低或相等,则返回 true,否则返回 false。
Syntax : numpy.issubdtype(arg1, arg2)
Parameters :
arg1, arg2 : [dtype_like] dtype or string representing a typecode.
Return : [bool] Boolean result.
代码#1:
# Python program explaining
# numpy.issubdtype() function
# importing numpy
import numpy as geek
# selecting the argument
arg1 = geek.int64
arg2 = geek.int32
# output boolean value
out_val = geek.issubdtype(arg1, arg2)
print ("Is the first argument lower: ", out_val)
输出 :
Is the first argument lower: False
代码#2:
# Python program explaining
# numpy.issubdtype() function
# importing numpy
import numpy as geek
# selecting the argument
arg1 ='S2'
arg2 = geek.string_
# output boolean value
out_val = geek.issubdtype(arg1, arg2)
print ("Is the first argument lower: ", out_val)
输出 :
Is the first argument lower: True