I want to highlight condition 1: every row in B which contains "a" and condition 2: if a row in B is highlighted the corresponding row in ID should be highlighted as well
import pandas as pd
import numpy as np
data = {'ID':[1,2,3,4,5,6,7,8,9,10],
'B':["a","b","c","a","e","f","a","h","c","a"],
'C': [5,7,8,9,12,3,60,55,20,14]
}
df = pd.DataFrame(data=data)
(df
.style
.apply(lambda x: np.where(x == "a", 'background-color : red', ''),axis=1,
subset=["B"])
)
to highlight condition 1 I used the above which works but I don't know how to implement the second condition.
