I have a dataframe that looks like this:
dataFrame = pd.DataFrame({'Name': [' Compound Mortar ',
' lime plaster ',
'mortar Screed ',
' Gypsum Plaster ',
' Gypsum Plaster 2',
' lime Plaster 233',
'Clay 23',
'Clay plaster Mortar']})
I am using a filter to search for certain words. My approach so far has been this:
dataFrame["Type"] = ""
mask1 = dataFrame["Name"].apply(lambda x: "Mortar".casefold() in "".join(x).casefold())
I would like that if the filtered word is present in the "NAME" column, the searched word is added in the "Type" column. It could happen that more words were to be found. For example, if you used a new filter with the word "Glue". In this case the corresponding row in the column "Type" should contain both keywords found. (A list would be fine)