With
Example with dataframe stolen from snippsat, "searching" cells containing substring in given column:
If you need to find string in any colum, you will probably need to iterate over columns and checks each seperately.
.str
you have access to many string manipulation functions, check documentation.Example with dataframe stolen from snippsat, "searching" cells containing substring in given column:
In [4]: df Out[4]: name age weight seniority pay 0 Bob 34 121 13 69000 1 Goal 19 63 2 23300 2 Amy 45 59 5 45000 3 Frank 56 93 12 57000 4 Kaka 23 55 7 45000 5 Udo 27 65 3 39000 6 Vera 31 71 8 45000 7 Betty 22 77 5 45000 In [5]: df.name[df.name.str.contains('Goal')] # returns series with strings that contains "Goal" Out[5]: 1 Goal Name: name, dtype: object In [6]: df[df.name.str.contains('Goal')].index # returns indices of "cells" that contains "Goal" Out[6]: Int64Index([1], dtype='int64')contains accepts regular expression, so for exact match you can use
"^Goal$"
.If you need to find string in any colum, you will probably need to iterate over columns and checks each seperately.