Use apply
or list comprehension:
s[s.apply(lambda x: isinstance(x, str))]
Same as, thanks Jon Clements?
:
s[s.apply(isinstance, args=(str,))]
s[[isinstance(x, str) for x in s]]
All return:
0 foo
1 bar
dtype: object
EDIT:
This is not recommended, thanks c???s????:
s[s.apply(type) == str]
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…