multiply two pandas dataframes

Viewed 897

I have two pandas dataframes:

df1

   id        type    NY    PA    MD
0  90  superurban   0.1   0.1  0.08
1  88       urban   0.1  0.08  0.08
2  75    suburban  0.06  0.04  0.04
3  60       rural  0.04  0.02  0.02

df2

  name  item
0   NY  1000
1   PA   500
2   MD   250

How can I multiple "item" values in df2 with df1 float values according to state abbreviations? The output should be:

   id  type         NY    PA   MD
0  90  superurban   100   50   20
1  88  urban        100   40   20
2  75  suburban      60   20   10
3  60  rural         40   10    5
2 Answers
Related