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