I want to check if the words in a dataframe B row exist inside another dataframe A row, and retrieve the LineNumber of dataframe A.
Example of dataframe A
LineNumber Description
2539 5401845 Either the well was very deep, or she fell very slowly,
4546 5409117 for she had plenty of time as she went down to look about her,
4368 5408517 and to wonder what was going to happen next
Example of dataframe B
Words
50062 well deep fell
44263 plenty time above
4731 plenty time down look
I want to now if ALL the words in each row of dataframe B are inside any row in dataframe A. If that's the case, I'd retrieve the LineNumber from dataframe A and assign it to dataframe B.
The output should be like this.
Words LineNumber
50062 well deep fell 5401845
44263 plenty time above
4731 plenty time down look 5409117
I have tried something like this but it's not working
a = 'for she had plenty of time as she went down to look about her,'
str = 'plenty time down look'
if all(x in str for x in a):
print(True)
else:
print(False)
Thanks