To do this in pandas:
In [255]: s[s==True].index Out[255]: Int64Index([0, 1, 2, 3, 4, 6, 7, 9, 11, 12, 13, 14, 15, 16, 22, 23, 27, 28, 29, 30, 31, 32, 33, 35, 36, 37, 38, 40, 41, 44, 45, 46, 48, 49, 50], dtype='int64')
Update
In fact, you can use the fact that the values โโare already Boolean values โโto mask the series:
In [256]: s[s].index Out[256]: Int64Index([0, 1, 2, 3, 4, 6, 7, 9, 11, 12, 13, 14, 15, 16, 22, 23, 27, 28, 29, 30, 31, 32, 33, 35, 36, 37, 38, 40, 41, 44, 45, 46, 48, 49, 50], dtype='int64')
Similarly for numpy arrays, you can use booleans to mask the array and get index values โโusing np.where :
In [261]: np.where(a)โ Out[261]: (array([ 0, 1, 2, 3, 4, 6, 7, 9, 11, 12, 13, 14, 15, 16, 22, 23, 27, 28, 29, 30, 31, 32, 33, 35, 36, 37, 38, 40, 41, 44, 45, 46, 48, 49, 50], dtype=int64),)