I´m dealing with this challenge quite a while and I couldn´t come up with a decent solution.
I have two dataframes with the same shape.

The thing I want to do is, is to color dataframe 1 based on the values contained in dataframe 2.
I´m able to color Dataframe 2 based on its own values but I couldn´t manage to transfer the 'Styling' to Dataframe 1.
Here is my code for this:
df1 = ...
df2 = ...
def apply_color(val):
colors = {1: 'green',2: 'blue', 3: 'yellow', 4: 'orange', 5: 'grey'}
return 'background-color: {}'.format(colors[val]) if val else ''
df2.style.applymap(df2)
Can anyone guide me to finalize this? :-)
Thanks a lot!
Best Regards, MG


