I have a pandas dataframe that I'd like to filter by a specific word (test) in a column. I tried:
df[df[col].str.contains('test')]
But it returns an empty dataframe with just the column names. For the output, I'm looking for a dataframe that'd contain all rows that contain the word 'test'. What can I do?
EDIT (to add samples):
data = pd.read_csv(/...csv)
data has 5 cols, including 'BusinessDescription', and I want to extract all rows that have the word 'dental' (case insensitive) in the Business Description col, so I used:
filtered = data[data['BusinessDescription'].str.contains('dental')==True]
and I get an empty dataframe, with just the header names of the 5 cols.
dfinstead ofdatawhen refering to dataframes. It is the common way around SO to use that notation.