I have a pd data frame like the following:
V1 V2
some text here a string
a string the sky is blue
I see something written here is a garden
See you soon Sun rises in the East
Sun rises in the East I wake up early
astring byebye
new string may be new
I want to delete from V2 the instances of 'a string' and 'Sun rises in the East' if those two matches 'exactly' with the instances in V1 (so nothing will change for the row of 'astring'). My target dataframe would be like this:
V1 V2
some text here
a string the sky is blue
I see something written here is a garden
See you soon
Sun rises in the East I wake up early
astring byebye
new string may be new
The instances in V2 is always one row above than where the respective string is in V1. I have tried shifting the V2 down and delete if it matches V1 but that does not work for all the cases. My thought is that V1 needs to be considered as a list and if any cell of V2 matches 'exactly' with any element of that list, that cell needs to be deleted. But I cannot seem to make this logic (if at all correct) work. Any help is appreciated!