[Numpy-discussion] astype char conversion

Matthew Brett matthew.brett at gmail.com
Tue Aug 8 20:52:11 CDT 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