Python numpy.issubdtype()
numpy.issubdtype()函数用于确定第一个参数是否是一个在类型层次上比第二个参数低/相等的类型码。
语法 : numpy.issubdtype(arg1, arg2)
参数 :
arg1, arg2 :[dtype_like] 代表类型码的dtype或字符串。
返回 :[bool] 布尔型结果。
代码 #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