資料型別類別 (numpy.dtypes)#

此模組包含與特定 dtype 相關的功能及其類別。如需關於 dtype 的更 general 資訊,另請參閱 numpy.dtype資料型別物件 (dtype)

類似於內建的 types 模組,此子模組定義了不常直接使用的型別 (類別)。

NumPy 版本新功能1.25

dtypes 模組是 NumPy 1.25 的新功能。先前 DType 類別僅能間接存取。

DType 類別#

以下是相應 NumPy dtype 實例和 NumPy 純量型別的類別。這些類別可用於 isinstance 檢查,也可以直接實例化或使用。直接使用這些類別並不常見,因為可以使用它們的純量對應物 (例如 np.float64) 或字串 (例如 "float64")。

布林#

numpy.dtypes.BoolDType[source]#

位元大小整數#

numpy.dtypes.Int8DType[source]#
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[source]#
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[source]#
numpy.dtypes.Float32DType#
numpy.dtypes.Float64DType#
numpy.dtypes.LongDoubleDType#

複數#

numpy.dtypes.Complex64DType[source]#
numpy.dtypes.Complex128DType#
numpy.dtypes.CLongDoubleDType#

字串與位元組字串#

numpy.dtypes.StrDType[source]#
numpy.dtypes.BytesDType#
numpy.dtypes.StringDType#

時間#

numpy.dtypes.DateTime64DType[source]#
numpy.dtypes.TimeDelta64DType#

其他#

numpy.dtypes.ObjectDType[source]#
numpy.dtypes.VoidDType#