I am trying to add a column with values from a dictionary. It will be easy to show you the dummy data.
df = pd.DataFrame({'id':[1,2,3,2,5], 'grade':[5,2,2,1,3]})
dictionary = {'1':[5,8,6,3], '2':[1,2], '5':[8,6,2]}
Notice that not every id is in the dictionary and the values which are the lists. I want to find the row in the df that matches with the keys in the dictionary and add the list in one column. So the desired output will look like this:
output = pd.DataFrame({'id':[1,2,3,2,5], 'grade':[5,2,2,1,3], 'new_column':[[5,8,6,3],[1,2],[],[1,2],[8,6,2]]})