I have a Series created like this
s = pd.Series({'a': False, 'b': True, 'c': False, 'd': True, 'e': False})
>> s
a False
b True
c False
d True
e False
dtype: bool
Is there a way to neatly extract the names of where it is True, staying within Pandas or NumPy and without going back to ordinary Python?
At the moment I am using this:
sdict = s.to_dict()
for item in list(sdict):
if sdict[item] == True:
print (item, end=" ")
>> b d