@@ -405,9 +405,10 @@ def f(x):
405
405
406
406
result = self .df .style .where (f , style1 )._compute ().ctx
407
407
expected = {
408
- (r , c ): [style1 if f ( self . df . loc [ row , col ]) else "" ]
408
+ (r , c ): [style1 ]
409
409
for r , row in enumerate (self .df .index )
410
410
for c , col in enumerate (self .df .columns )
411
+ if f (self .df .loc [row , col ])
411
412
}
412
413
assert result == expected
413
414
@@ -966,7 +967,6 @@ def test_bar_align_mid_nans(self):
966
967
"transparent 25.0%, #d65f5f 25.0%, "
967
968
"#d65f5f 50.0%, transparent 50.0%)" ,
968
969
],
969
- (1 , 0 ): ["" ],
970
970
(0 , 1 ): [
971
971
"width: 10em" ,
972
972
" height: 80%" ,
@@ -994,7 +994,6 @@ def test_bar_align_zero_nans(self):
994
994
"transparent 50.0%, #d65f5f 50.0%, "
995
995
"#d65f5f 75.0%, transparent 75.0%)" ,
996
996
],
997
- (1 , 0 ): ["" ],
998
997
(0 , 1 ): [
999
998
"width: 10em" ,
1000
999
" height: 80%" ,
@@ -1091,7 +1090,7 @@ def test_format_with_bad_na_rep(self):
1091
1090
def test_highlight_null (self , null_color = "red" ):
1092
1091
df = pd .DataFrame ({"A" : [0 , np .nan ]})
1093
1092
result = df .style .highlight_null ()._compute ().ctx
1094
- expected = {(0 , 0 ): [ "" ], ( 1 , 0 ): ["background-color: red" ]}
1093
+ expected = {(1 , 0 ): ["background-color: red" ]}
1095
1094
assert result == expected
1096
1095
1097
1096
def test_highlight_null_subset (self ):
@@ -1104,9 +1103,7 @@ def test_highlight_null_subset(self):
1104
1103
.ctx
1105
1104
)
1106
1105
expected = {
1107
- (0 , 0 ): ["" ],
1108
1106
(1 , 0 ): ["background-color: red" ],
1109
- (0 , 1 ): ["" ],
1110
1107
(1 , 1 ): ["background-color: green" ],
1111
1108
}
1112
1109
assert result == expected
@@ -1219,17 +1216,13 @@ def test_highlight_max(self):
1219
1216
expected = {
1220
1217
(1 , 0 ): ["background-color: yellow" ],
1221
1218
(1 , 1 ): ["background-color: yellow" ],
1222
- (0 , 1 ): ["" ],
1223
- (0 , 0 ): ["" ],
1224
1219
}
1225
1220
assert result == expected
1226
1221
1227
1222
result = getattr (df .style , attr )(axis = 1 )._compute ().ctx
1228
1223
expected = {
1229
1224
(0 , 1 ): ["background-color: yellow" ],
1230
1225
(1 , 1 ): ["background-color: yellow" ],
1231
- (0 , 0 ): ["" ],
1232
- (1 , 0 ): ["" ],
1233
1226
}
1234
1227
assert result == expected
1235
1228
0 commit comments