数据类型类 ( 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#