ptypy.utils.misc.str2int#

ptypy.utils.misc.str2int(A)#

Transforms numpy array A of strings to np.uint8 and back

Examples

>>> from ptypy.utils import str2int
>>> A=np.array('hallo')
>>> A
array('hallo', dtype='|S5')
>>> str2int(A)
array([104,  97, 108, 108, 111], dtype=uint8)
>>> str2int(str2int(A))
array('hallo', dtype='|S5')