No answer was given to this question ... but the question itself and the comments received an answer that already worked very well for me .. and I did not find the answer wherever I looked.
So I just copied the answer to the question for those who might find this useful. I added case = False for case insensitive serach
Solution from @Reason:
the best I've come up with so far is rather cumbersome
this one worked for me.
df[df.apply(lambda r: r.str.contains('b', case=False).any(), axis=1)]
Solution from @rbinnun:
this one worked for me for a test data set .. but for some real data set .. it returned an error in unicode as shown below, but as a rule, this is also a good solution.
df[df.apply(lambda row: row.astype(str).str.contains('b', case=False).any(), axis=1)]
takes care of non-row columns, nans, etc.
UnicodeEncodeError: 'ascii' codec can't encode character u'\xae' in position 5: ordinal not in range(128)
source share