Found this link and my work is somewhat similar.
Say I have:
x = ['the', 'the', 'and', 'a', 'apple', 'heart', 'heart']
y = {'words': ['the', 'belt', 'computer', 'heart','and'],'values':[3,2,1,1,4]}
Using the suggestion in the link above, I got this:
df = pd.DataFrame.from_dict(y)
items = set(df['words'])
found = [i for i in x if i in items]
print(found)
The result is: ['the', 'the', 'and', 'heart', 'heart']
I want to be able to get the corresponding value of the word and I am stuck. The result I want is this:
[3,3,4,1,1]
Any thoughts on how to achieve this? Would greatly appreciate it.