I would like to color in red cells of a DataFrame on one column, based on the value of another column.
Here is an example:
df = pd.DataFrame([
{ 'color_A_in_red': True , 'A': 1 },
{ 'color_A_in_red': False , 'A': 2 },
{ 'color_A_in_red': True , 'A': 2 },
])
I know how to color a cell of a df in red but only based on the value of this cell, not the value of another cell:
df_style = df.style
df_style.applymap(func=lambda x: 'background-color: red' if x == 2 else None, subset=['A'])
df_style
Is there a way to color cells of a DataFrame based on the value of another column ?

