29 Mar
2006
29 Mar
'06
4:17 a.m.
from numpy import * c =char.array(['on','two','three']) c chararray([on, two, three], dtype='|S5') c=='on' array([True, False, False], dtype=bool) c==c[0] array([False, False, False], dtype=bool) c==str(c[0]) array([True, False, False], dtype=bool) c[0] 'on' len(c[0]) 5 c.dtype
As shown in the example below, chararray comparisons do not seem to work well when stringscalars are used. In the example below I am also curious as to whether the the length of c[0] should be 2 instead of 5. numpy.__version__ 0.9.6 dtype('|S5')
c==c[2] array([False, False, True], dtype=bool)