[Numpy-discussion] astype char conversion

Matthew Brett matthew.brett at gmail.com
Tue Aug 8 21:52:11 EDT 2006


Hi,

Sorry if this is silly question, but should this work to convert from
int8 to character type?

a = array([104, 105], dtype=N.int8)
a.astype('|S1')

I was a bit surprised by the output:

array([1, 1],
      dtype='|S1')

Thanks a lot,

Matthew




More information about the NumPy-Discussion mailing list