Hi - I am trying to find a string in a list with strings and have come across the following state of affairs:

In [228]: subjects
Out[228]:
['KAA',
 'CCS',
 'EJS',
 'MNM',
 'JHS',
 'LJL',
 'DVA',
 'FCL',
 'CNC',
 'KFM',
 'APM',
 'GMC']

In [229]: subjects[0]
Out[229]: 'KAA'

In [230]: subjects[0] == 'KAA'
Out[230]: True

In [231]: np.where(subjects == 'KAA')
Out[231]: ()

In [232]: pylab.find(subjects == 'KAA')
Out[232]: array([], dtype=int32)

It doesn't seem to matter if I make the list into an array:

In [233]: np.array(subjects)
Out[233]:
array(['KAA', 'CCS', 'EJS', 'MNM', 'JHS', 'LJL', 'DVA', 'FCL', 'CNC',
       'KFM', 'APM', 'GMC'],
      dtype='|S3')

In [234]: pylab.find(subjects == 'KAA')
Out[234]: array([], dtype=int32)

In [235]: np.where(subjects == 'KAA')
Out[235]: ()

What am I doing wrong? What does it mean that the dtype is IS3?

Thanks a bunch --

Ariel

_______________________________________________
Numpy-discussion mailing list
[email protected]
http://projects.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to