I'm trying to make a heat map using a weighted average percentage. I was trying to do something similar to using a calculated field in a pivot table in excel, but wound up with two grouped data frames with the same index and columns. The grouping was done by two sets of predetermined buckets, one of which I unstacked to be the column headers (eg. [0,10,20,50,100] and [0,1,2,5,10]).
df7 = df5.groupby(['SomeBuckets','MoreBuckets']).sum().astype(float).unstack(['MoreBuckets'])
df8 = df6.groupby(['SomeBuckets','MoreBuckets']).sum().astype(float).unstack(['MoreBuckets'])
I'm not sure how to divide the two literally cell by cell, is there a way to do this? I tried
df9 = df7.truediv(df8,axis=0,fill_value='')
but all that gave me was a dtype error, could not convert string to float.