I've scoured the forums and am still struggling with this.
Say I have a dictionary of keys with html colours as values, i.e:
colours = {'a': '#2DB2EC',
'b': '#A71AB7',
'c': '#EB4141',
'd': '#EB4141',
'e': '#36D22C',
'f': '#2C4ED2',
'g': '#137C15',
'h': '#F4EA06'}
I also have a dataframe with two columns, one of which (col1) corresponds to the keys in my "colours" dictionary:
col1 col2
a 900
d 1000
h 800
z 750
m 100
l 50
How do I use the Pandas style.applymap to colour-code the second column based on the dictionary value of column one (leaving it blank/white if no value found)? I've been playing around with some lambda functions but am having real difficulty in getting anything to work.
Sorry if this is a basic question and thanks in advance.