I have this dictionary:
j = {1: {'help': 2},
2: {'chocolate': 1, 'help': 1},
3: {'chocolate': 1, 'help': 1}}
and this dataframe:
df = pd.DataFrame({'docId': [1, 2, 3, 1, 2, 3, ],
'sent': ['help', 'chocolate', 'chocolate', 'help', 'help', 'help']})
and I want to match the values according to docId and term so it should look like this:
docId sent freq
1 help 2
2 chocolate 1
3 chocolate 1
1 help 2
2 help 1
3 help 1
I'm not sure how to accomplish this, I was working on using map and apply but I didn't get anywhere.