0

I have a dataframe with numerical data I want to highlight the two minimum values row-wise excluding one column (target). This is what I get so far, but stuck on excluding the mentioned column and so is highlighted too.

np.random.seed(123)
rows = 5
cols= {'column_a': [np.random.randint(100) for _ in range(rows)],
       'column_b': [np.random.randint(100) for _ in range(rows)],
       'column_c': [np.random.randint(100) for _ in range(rows)],
       'target': [np.random.randint(100) for _ in range(rows)]}
data = pd.DataFrame(cols)

(data.style.highlight_min(props='background-color:lightgreen', axis=1) )

enter image description here

Trenton McKinney
  • 56,955
  • 33
  • 144
  • 158
Forge
  • 1,587
  • 1
  • 15
  • 36

0 Answers0