Character Codes

The table below list the most common data types and the character codes related to them.

TypeCharacter Code
integeri
unasigned integeru
single precision floatf
double precision floatd
boolb
complexD
stringS
unicodeU
voidV

Example:

Producing an array of single precision floats:

import numpy as np

np.arange(5, dtype='f')

#out
array([ 0.,  1.,  2.,  3.,  4.], dtype=float32)

Producing an array of complex numbers:

import numpy as np

np.arange(5, dtype='D')

#out
array([ 0.+0.j,  1.+0.j,  2.+0.j,  3.+0.j,  4.+0.j])

Leave a Reply