数据类型类 (numpy.dtypes)#

此模块包含与特定 dtypes 相关的功能及其类。有关 dtypes 的更多一般信息,另请参阅 numpy.dtype数据类型对象 (dtype)

类似于内置的 types 模块,此子模块定义了不常直接使用的类型(类)。

NumPy 新版本1.25

dtypes 模块在 NumPy 1.25 中是新增的。以前,DType 类只能间接访问。

DType 类#

以下是对应 NumPy dtype 实例和 NumPy 标量类型的类。这些类可用于 isinstance 检查,也可以直接实例化或使用。直接使用这些类并不常见,因为可以使用它们的标量对应物(例如 np.float64)或字符串(例如 "float64")。

布尔#

numpy.dtypes.BoolDType[源代码]#

位大小整数#

numpy.dtypes.Int8DType[源代码]#
numpy.dtypes.UInt8DType#
numpy.dtypes.Int16DType#
numpy.dtypes.UInt16DType#
numpy.dtypes.Int32DType#
numpy.dtypes.UInt32DType#
numpy.dtypes.Int64DType#
numpy.dtypes.UInt64DType#

C 命名整数(可能是别名)#

numpy.dtypes.ByteDType[源代码]#
numpy.dtypes.UByteDType#
numpy.dtypes.ShortDType#
numpy.dtypes.UShortDType#
numpy.dtypes.IntDType#
numpy.dtypes.UIntDType#
numpy.dtypes.LongDType#
numpy.dtypes.ULongDType#
numpy.dtypes.LongLongDType#
numpy.dtypes.ULongLongDType#

浮点#

numpy.dtypes.Float16DType[源代码]#
numpy.dtypes.Float32DType#
numpy.dtypes.Float64DType#
numpy.dtypes.LongDoubleDType#

复数#

numpy.dtypes.Complex64DType[源代码]#
numpy.dtypes.Complex128DType#
numpy.dtypes.CLongDoubleDType#

字符串和字节串#

numpy.dtypes.StrDType[源代码]#
numpy.dtypes.BytesDType#
numpy.dtypes.StringDType#

时间#

numpy.dtypes.DateTime64DType[源代码]#
numpy.dtypes.TimeDelta64DType#

其他#

numpy.dtypes.ObjectDType[源代码]#
numpy.dtypes.VoidDType#