40
loading...
This website collects cookies to deliver better user experience
arr = np.array([1,2,3],dtype="float64")
print(arr.dtype) # dtype('float64')
Type | Type Code | Description |
---|---|---|
int8, uint8 | i1, u1 | Signed and unsigned 8-bit (1 byte) integer types |
int16, uint16 | i2, u2 | Signed and unsigned 16-bit integer types |
int32, uint32 | i4, u4 | Signed and unsigned 32-bit integer types |
int64, uint64 | i8, u8 | Signed and unsigned 64-bit integer types |
float16 | f2 | Half-precision floating point |
float32 | f4 or f | Standard single-precision oating point; compatible with C oat |
float64 | f8 or d | Standard double-precision oating point; compatible with C double and Python float object |
float128 | f16 or g | Extended-precision oating point |
complex64 | c8, c16 | Complex numbers represented by two 32 floats |
complex128 | c32 | Complex numbers represented by two 64 float |
complex256 | c32 | Complex numbers represented by two 128 float |
bool | ? | Boolean type storing True and False values |
object | O | Python object type; a value can be any Python object |
string_ | S | Fixed-length ASCII string type (1 byte per character); for example, to create a string dtype with length 10, use 'S10' |
unicode_ | U | Fixed-length Unicode type (number of bytes platform specific); same specification semantics as string_ (e.g., 'U10') |
It’s important to be cautious when using the numpy.string_
type,as string data in NumPy is fixed size and may
truncate input without warning. pandas has more intuitive
out-of-the-box behavior on non-numeric data.