Skip to main content
`Ctrl`+`K`

# Data type classes (`numpy.dtypes`)

This module is home to specific dtypes related functionality and their classes. For more general information about dtypes, also see `numpy.dtype` and Data type objects (dtype).

Similar to the builtin `types` module, this submodule defines types (classes) that are not widely used directly.

New in version NumPy: 1.25

The dtypes module is new in NumPy 1.25. Previously DType classes were only accessible indirectly.

## DType classes

The following are the classes of the corresponding NumPy dtype instances and NumPy scalar types. The classes can be used in `isinstance` checks and can also be instantiated or used directly. Direct use of these classes is not typical, since their scalar counterparts (e.g. `np.float64`) or strings like `"float64"` can be used.

## Boolean

numpy.dtypes.BoolDType

## Bit-sized integers

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-named integers (may be aliases)

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

## Floating point

numpy.dtypes.Float16DType
numpy.dtypes.Float32DType
numpy.dtypes.Float64DType
numpy.dtypes.LongDoubleDType

## Complex

numpy.dtypes.Complex64DType
numpy.dtypes.Complex128DType
numpy.dtypes.CLongDoubleDType

## Strings and Bytestrings

numpy.dtypes.StrDType
numpy.dtypes.BytesDType
numpy.dtypes.StringDType

## Times

numpy.dtypes.DateTime64DType
numpy.dtypes.TimeDelta64DType

## Others

numpy.dtypes.ObjectDType
numpy.dtypes.VoidDType

## Routines for DType authors

`register_dlpack_dtype`(dlpack_key, dtype, /) | Register a NumPy dtype for a DLPack `(code, bits)` pair so that `numpy.from_dlpack` can import it and `ndarray.__dlpack__` can export it.