NumPy numerical types
Python has an integer
type, a float
type, and complex
type; nonetheless, this is not sufficient for scientific calculations. In practice, we still demand more data types with varying precisions and, consequently, different storage sizes of the type. For this reason, NumPy has many more data types. The bulk of the NumPy mathematical types end with a number. This number designates the count of bits related to the type. The following table (adapted from the NumPy user guide) presents an overview of NumPy numerical types:
Type |
Description |
---|---|
|
Boolean ( |
|
Platform integer (normally either |
|
Byte (-128 to 127) |
|
Integer (-32768 to 32767) |
|
Integer (-2 ** 31 to 2 ** 31 -1) |
|
Integer (-2 ** 63 to 2 ** 63 -1) |
|
Unsigned integer (0 to 255) |
|
Unsigned integer (0 to 65535) |
|
Unsigned integer (0 to 2 ** 32 - 1) |
|
Unsigned integer (0 to 2 ** 64 - 1) |
|