This is an easy one. The task is to check if a string in one column contains all words stored in another string. Based on this do something. Here is a simple example
import pandas as pd
df = pd.DataFrame({'Strings':["The brown","fox smoked 6", "cigarettes per day", "in his cave"],
'Set': ["Alpha", "Beta", "Gamma", "Delta"]})
... >>> df
Set Strings
0 Alpha The brown
1 Beta fox smoked 6
2 Gamma cigarettes per day
3 Delta in his cave
>>>
Now i want to check in each row of df["Strings"] if it contains the word "smoked" and the number "6" (which is true for row 3 here). If so, I need the new column df["Result"] to be equal to df["Set"] but with the words "health damaging" added to it. If not just copy what's contained in df["Set"]. Output should look like this:
... >>> df_final
Set Strings Result
0 Alpha The brown Alpha
1 Beta fox smoked 6 Beta health damaging
2 Gamma cigarettes per day Gamma
3 Delta in his cave Delta
>>>