@@ -404,9 +404,10 @@ def f(x):
404
404
405
405
result = self .df .style .where (f , style1 )._compute ().ctx
406
406
expected = {
407
- (r , c ): [style1 if f ( self . df . loc [ row , col ]) else "" ]
407
+ (r , c ): [style1 ]
408
408
for r , row in enumerate (self .df .index )
409
409
for c , col in enumerate (self .df .columns )
410
+ if f (self .df .loc [row , col ])
410
411
}
411
412
assert result == expected
412
413
@@ -954,7 +955,6 @@ def test_bar_align_mid_nans(self):
954
955
"transparent 25.0%, #d65f5f 25.0%, "
955
956
"#d65f5f 50.0%, transparent 50.0%)" ,
956
957
],
957
- (1 , 0 ): ["" ],
958
958
(0 , 1 ): [
959
959
"width: 10em" ,
960
960
" height: 80%" ,
@@ -982,7 +982,6 @@ def test_bar_align_zero_nans(self):
982
982
"transparent 50.0%, #d65f5f 50.0%, "
983
983
"#d65f5f 75.0%, transparent 75.0%)" ,
984
984
],
985
- (1 , 0 ): ["" ],
986
985
(0 , 1 ): [
987
986
"width: 10em" ,
988
987
" height: 80%" ,
@@ -1077,7 +1076,7 @@ def test_format_with_bad_na_rep(self):
1077
1076
def test_highlight_null (self , null_color = "red" ):
1078
1077
df = pd .DataFrame ({"A" : [0 , np .nan ]})
1079
1078
result = df .style .highlight_null ()._compute ().ctx
1080
- expected = {(0 , 0 ): [ "" ], ( 1 , 0 ): ["background-color: red" ]}
1079
+ expected = {(1 , 0 ): ["background-color: red" ]}
1081
1080
assert result == expected
1082
1081
1083
1082
def test_nonunique_raises (self ):
@@ -1187,17 +1186,13 @@ def test_highlight_max(self):
1187
1186
expected = {
1188
1187
(1 , 0 ): ["background-color: yellow" ],
1189
1188
(1 , 1 ): ["background-color: yellow" ],
1190
- (0 , 1 ): ["" ],
1191
- (0 , 0 ): ["" ],
1192
1189
}
1193
1190
assert result == expected
1194
1191
1195
1192
result = getattr (df .style , attr )(axis = 1 )._compute ().ctx
1196
1193
expected = {
1197
1194
(0 , 1 ): ["background-color: yellow" ],
1198
1195
(1 , 1 ): ["background-color: yellow" ],
1199
- (0 , 0 ): ["" ],
1200
- (1 , 0 ): ["" ],
1201
1196
}
1202
1197
assert result == expected
1203
1198
0 commit comments