Consider the code:
df = pd.read_csv('...csv')
array = [.....,....,....]
results = df[df.Message.isin(array).fillna(False)]
The column Message
contains more than one word.
How can we get all rows that have the column "Message" where at least one of the words in Message
is in the array
?
Example:
Client Message City Phone
Jackson I will back soon Rome 1111
Cole Please try to be patient Cairo 2222
Rains Sure anything you want , anything Paris 3333
Array = ['try', 'anything', 'patient']
Result:
Cole Please try to be patient Cairo 2222
Rains Sure anything you want , anything Paris 3333