I have a dataframe where I expect all the rows that matches a given substring to be written as a list.
df1 = pd.DataFrame({'col1': ["c1", "match", "c3", "c4", "c5", "c6","c7","c8","c9"],
'col2': [" ","a1","a2","Smatch6","a4"," ","a8"," ","a7"],
'col3': ["Red", "Ted", "Pet", "match1", "Pmatch", "Rmatchd","sample","agadR","Padgadg"]
})
The output should go as a list into a Dictionary
Data_Dictionary['data'] = o/p of this
tried this code, but it returns nothing
resultdf = df1.filter(like='match', axis=0)
Expected Result: resultdf
col1 col2 col3
1 match a1 Ted
3 c4 Smatch6 match1
5 c6 Rmatchd