I am trying to highlight complete row based on index values. Here is what i did:
df = pd.read_excel(module)
rows = df.index[df['MYCOLUMN'].str.contains(command, na=False)].tolist()
if rows:
df.style.apply(lambda x: ['background: red' if x.name in rows else '' for i in x], axis=1)
df.to_excel(module, index = False)
But the row is not getting highligted and the formatting of my excel is also changed. Can someone tell the right way of doing this?