以下は colabでの結果
(HTMLが出力されるわけmarkdownではないが, 結果を貼り付けるため色指定できなかったので画像で)
<style type="text/css">
#T_f0553_row2_col1 {
color: white;
background-color: purple;
}
#T_f0553_row3_col1 {
color: white;
background-color: darkblue;
}
#T_f0553_row11_col1 {
color: white;
background-color: pink;
}
</style>
<table id="T_f0553_">
<thead>
<tr>
<th class="blank level0" > </th>
<th class="col_heading level0 col0" >id</th>
<th class="col_heading level0 col1" >数値</th>
<th class="col_heading level0 col2" >分類</th>
</tr>
</thead>
<tbody>
<tr>
<th id="T_f0553_level0_row0" class="row_heading level0 row0" >0</th>
<td id="T_f0553_row0_col0" class="data row0 col0" >aaa</td>
<td id="T_f0553_row0_col1" class="data row0 col1" >3141</td>
<td id="T_f0553_row0_col2" class="data row0 col2" >type2</td>
</tr>
<tr>
<th id="T_f0553_level0_row1" class="row_heading level0 row1" >1</th>
<td id="T_f0553_row1_col0" class="data row1 col0" >bbb</td>
<td id="T_f0553_row1_col1" class="data row1 col1" >5926</td>
<td id="T_f0553_row1_col2" class="data row1 col2" >type1</td>
</tr>
<tr>
<th id="T_f0553_level0_row2" class="row_heading level0 row2" >2</th>
<td id="T_f0553_row2_col0" class="data row2 col0" >ccc</td>
<td id="T_f0553_row2_col1" class="data row2 col1" >5358</td>
<td id="T_f0553_row2_col2" class="data row2 col2" >type3</td>
</tr>
<tr>
<th id="T_f0553_level0_row3" class="row_heading level0 row3" >3</th>
<td id="T_f0553_row3_col0" class="data row3 col0" >ddd</td>
<td id="T_f0553_row3_col1" class="data row3 col1" >9793</td>
<td id="T_f0553_row3_col2" class="data row3 col2" >type1</td>
</tr>
<tr>
<th id="T_f0553_level0_row4" class="row_heading level0 row4" >4</th>
<td id="T_f0553_row4_col0" class="data row4 col0" >eee</td>
<td id="T_f0553_row4_col1" class="data row4 col1" >2384</td>
<td id="T_f0553_row4_col2" class="data row4 col2" >type3</td>
</tr>
<tr>
<th id="T_f0553_level0_row5" class="row_heading level0 row5" >5</th>
<td id="T_f0553_row5_col0" class="data row5 col0" >fff</td>
<td id="T_f0553_row5_col1" class="data row5 col1" >6264</td>
<td id="T_f0553_row5_col2" class="data row5 col2" >type2</td>
</tr>
<tr>
<th id="T_f0553_level0_row6" class="row_heading level0 row6" >6</th>
<td id="T_f0553_row6_col0" class="data row6 col0" >ggg</td>
<td id="T_f0553_row6_col1" class="data row6 col1" >3383</td>
<td id="T_f0553_row6_col2" class="data row6 col2" >type2</td>
</tr>
<tr>
<th id="T_f0553_level0_row7" class="row_heading level0 row7" >7</th>
<td id="T_f0553_row7_col0" class="data row7 col0" >hhh</td>
<td id="T_f0553_row7_col1" class="data row7 col1" >2795</td>
<td id="T_f0553_row7_col2" class="data row7 col2" >type1</td>
</tr>
<tr>
<th id="T_f0553_level0_row8" class="row_heading level0 row8" >8</th>
<td id="T_f0553_row8_col0" class="data row8 col0" >iii</td>
<td id="T_f0553_row8_col1" class="data row8 col1" >288</td>
<td id="T_f0553_row8_col2" class="data row8 col2" >type3</td>
</tr>
<tr>
<th id="T_f0553_level0_row9" class="row_heading level0 row9" >9</th>
<td id="T_f0553_row9_col0" class="data row9 col0" >jjj</td>
<td id="T_f0553_row9_col1" class="data row9 col1" >4197</td>
<td id="T_f0553_row9_col2" class="data row9 col2" >type1</td>
</tr>
<tr>
<th id="T_f0553_level0_row10" class="row_heading level0 row10" >10</th>
<td id="T_f0553_row10_col0" class="data row10 col0" >kkk</td>
<td id="T_f0553_row10_col1" class="data row10 col1" >1693</td>
<td id="T_f0553_row10_col2" class="data row10 col2" >type3</td>
</tr>
<tr>
<th id="T_f0553_level0_row11" class="row_heading level0 row11" >11</th>
<td id="T_f0553_row11_col0" class="data row11 col0" >lll</td>
<td id="T_f0553_row11_col1" class="data row11 col1" >9937</td>
<td id="T_f0553_row11_col2" class="data row11 col2" >type2</td>
</tr>
<tr>
<th id="T_f0553_level0_row12" class="row_heading level0 row12" >12</th>
<td id="T_f0553_row12_col0" class="data row12 col0" >mmm</td>
<td id="T_f0553_row12_col1" class="data row12 col1" >5105</td>
<td id="T_f0553_row12_col2" class="data row12 col2" >type2</td>
</tr>
<tr>
<th id="T_f0553_level0_row13" class="row_heading level0 row13" >13</th>
<td id="T_f0553_row13_col0" class="data row13 col0" >nnn</td>
<td id="T_f0553_row13_col1" class="data row13 col1" >8209</td>
<td id="T_f0553_row13_col2" class="data row13 col2" >type1</td>
</tr>
</tbody>
</table>
update
さらに別解。(色付けの表現の回答もありだと判断して)
分類ごとの 最大値と最小値と, それに平均未満のデータの色分け
平均未満は少し薄めの文字色にしてるけど見えづらいようならすみません
def highlight(s, maxprops='', minprops='', meanprops=''):
grouped = s.groupby(level=1)
return np.select([
s == grouped.transform('max'),
s == grouped.transform('min'),
s < grouped.transform('mean'),
], [maxprops, minprops, meanprops], default='')
df = dfx.set_index('分類', append=True)
df.style.apply(highlight, maxprops='background-color:pink;',
minprops='background-color:yellow',
meanprops='color:darkgray',
subset='数値')