Data Types and Data Storage
NumPy Data Types
Type |
Description |
Remarks |
|---|---|---|
bool__ |
Boolean data type (true or false) |
A NumPy data type is actually an instance of the dtype object and can correspond to a unique character, for example, numpy.bool__, numpy.int32, or numpy.float64. |
int__ |
Default integer type (similar to long, int32, or int64 in C language) |
|
intc |
Same as the int type of C, generally int32 or int64 |
|
intp |
Integer type used for indexing (similar to ssize_t of C, which is still int32 or int64 in general) |
|
int8 |
Byte (-128 to 127) |
|
int16 |
Integer (-32768 to 32767) |
|
int32 |
Integer (-2147483648 to 2147483647) |
|
int64 |
Integer (-9223372036854775808 to 9223372036854775807) |
|
uint8 |
Unsigned integer (0 to 255) |
|
uint16 |
Unsigned integer (0 to 65535) |
|
uint32 |
Unsigned integer (0 to 4294967295) |
|
uint64 |
Unsigned integer (0 to 18446744073709551615) |
|
float__ |
Abbreviation of the float64 type |
|
float16 |
Half-precision floating point number, including one sign bit, five exponent bits, and 10 mantissa bits |
|
float32 |
Single-precision floating point number, including one sign bit, eight exponent bits, and 23 mantissa bits |
|
float64 |
Double-precision floating point number, including 1 sign bit, 11 exponent bits, and 52 mantissa bits |
|
complex__ |
Abbreviation of the complex128 type, that is, 128-bit complex number |
|
complex64 |
Complex number, represented by two 32-bit floats (real and imaginary parts) |
|
complex128 |
Complex number, represented by two 64-bit floats (real and imaginary parts) |
Other NumPy Data Types
- array_like can be the first argument that passes numpy.array() to create any content of an array.
- Optional: ndarray: multi-dimensional array that stores data of a single type. You can use indexes (starting from 0) to access elements in an ndarray object. Any array_like object can be converted to an ndarray object using the numpy.array() function.
- scalar: A scalar may be any data type listed in NumPy Data Types.