Next / Previous / Contents / Shipman's homepage

4. Basic types

NumPy has a much richer set of data types than standard Python. The type object for a NumPy type is called a dtype.

Each type has a type name. This table shows the names and describes their functions. Seven of these types are functionally identical to standard Python types, so their names have an underscore (_) appended to differentiate them. The exact meanings may depend on the underlying hardware platform.

bool_ Boolean, True or False.
byte One-byte signed integer.
short C-language short integer.
intc C-language int integer.
int_ Python int.
int8, int16, int32 Signed integers with 8, 16, and 32 bits respectively.
longlong Signed arbitrary-length integer.
intp An integer sized to hold a memory address.
ubyte Unsigned 8-bit integer.
ushort Unsigned C short.
uintc Unsigned C int.
uint Unsigned integer.
uint8, uint16, uint32 Unsigned integers of 8, 16, and 32 bits respectively.
ulonglong Unsigned arbitrary-length integer.
uintp Unsigned integer big enough to hold an address.
single Single-precision float.
float_ Python float.
longfloat Double-precision float.
float32, float64 Floats of 32 and 64 bits, respectively.
csingle Single-precision complex.
complex_ Python complex.
clongfloat Double-precision complex.
object_ For arrays of arbitrary Python objects.
str_ Eight-bit character string.
unicode_ Thirty-two-bit character string.