I have an array of the form:
array = ['A', 'D', 'A', 'A', 'A', 'D', 'A', 'A', 'D', 'A']
And I need to get the positions of the array where I find 'D'
. What I'm trying to do is:
d_pos[numpy.where(array == 'D')]
But I get the following error:
TypeError: list indices must be integers, not tuple
Searching I have seen that numpy.where
use it looking for numerical values, but it is not clear to me if it also works looking for letters in this case.
And another thing, actually the values in the array when I print them appear in unicode, like this:
array = [u'A', u'D', u'A', u'A', u'A', u'D', u'A', u'A', u'D', u'A']
And I do not know if the error is due to the format or the numpy.where
Does anyone know what I'm doing wrong?