I have one pandas dataframe that I want to style the format based on the values of another dataframe of the same shape/size. I'm trying to use applymap.
Here's an example:
t1= pd.DataFrame({'x':['A','B','C'], 'y':['C','B','D']})
t2= pd.DataFrame({'x':[0.3,0.2,0.7], 'y':[1,0.3,2]})
def color_cells(s, threshold=0.5):
if s > threshold:
return 'color:{0}; font-weight:bold'.format('red')
else:
return ''
#Tried
t1.style.applymap(t2.applymap(color_cells))
Ideally in t1 where the corresponding cells in t2>0.5 then the values in t1 are in 'red-bold'.
However, I'm unsure what pattern I should use to get this desired effect.