I have a dictionary as
Er = {'A':3,'B':5,'C':7,'D':6}
and a dataframe as
df = pd.DataFrame({'r': ['A', 'B', 'D', ]})
how do i get total of dictionary values with dictionary comprehension where, keys are matching in dataframe column? something like for A,B and D in dataframe, sum of corresponding values in dictionary is 3+5+6 = 14.
It seems easier to me to turn the dictionary into a dataframe.
Output
Into a dataframe and serve
dfrows as indexes.Output