Suppose I have a simple dataframe of 2x2 size. In the color_matrix of the same size as the dataframe, it stores the color for each cell.
Question: How to style the dataframe given the color matrix? Also need to make sure the dataframe can be saved as an Excel file which has all the colorings.
d = {'col1': [1, 2], 'col2': [3, 4]}
color_matrix = [['Yellow', 'Red'],
['Green', 'Blue']]
df = pd.DataFrame(data=d)
df
When I read about the use examples of df.style.applymap, it conditions on individual value, but not seems using the index.
