numpy.isdtype#
- numpy.isdtype(dtype, kind)[源代码]#
确定提供的 dtype 是否为指定的
kind数据类型.此函数仅支持 NumPy 内置的数据类型. 尚不支持第三方 dtype.
- 参数:
- dtypedtype
输入 dtype.
- kinddtype 或 str 或 dtype/str 的元组.
dtype 或 dtype 类型.允许的 dtype 类型有: *
'bool':布尔类型 *'signed integer':有符号整数数据类型 *'unsigned integer':无符号整数数据类型 *'integral':整数数据类型 *'real floating':实值浮点数据类型 *'complex floating':复数浮点数据类型 *'numeric':数字数据类型
- 返回:
- outbool
参见
示例
>>> import numpy as np >>> np.isdtype(np.float32, np.float64) False >>> np.isdtype(np.float32, "real floating") True >>> np.isdtype(np.complex128, ("real floating", "complex floating")) True