Goal: Remove items from my list, strings_2_remove, from a series.
I have a list of strings like so:
strings_2_remove = [
"dogs are so cool",
"cats have cute toe beans"
]
I also have a series of strings that looks like this:
df.Sentences.head()
0 dogs are so cool because they are nice and funny
1 many people love cats because cats have cute toe beans
2 hamsters are very small and furry creatures
3 i got a dog because i know dogs are so cool because they are nice and funny
4 birds are funny when they dance to music, they bop up and down
Name: Summary, dtype: object
The outcome after removing the strings in the list from the series should look like this:
0 because they are nice and funny
1 many people love cats because
2 hamsters are very small and furry creatures
3 i got a dog because i know because they are nice and funny
4 birds are funny when they dance to music, they bop up and down
Name: Summary, dtype: object
I have the following in attempt to achieve the output I want:
mask_1 = (df.Sentences == strings_2_remove)
df.loc[mask_1, 'df.Sentences'] = " "
However, it is not achieving my goal.
Any suggestions?