I'm trying to iterate through a dataframe, where I've indexed the data using a series of string names. I want to search these indices for a certain substring and then place all those rows that have the substring into another dataframe.
suppose my original dataframe is called df.
I've tried:
find_cat = df[df.str.contains("cat")]
And also tried
find_cat =
for row_index,row in df.iterrows():
if row_index.str.contains("cat", na=True):
find_cat(append(row)
Both of these fail [try 1 = error in syntax, try 2 = an empty dataframe.
Quite new to python and Pandas....any help greatly appreciated!