@@ -328,15 +328,14 @@ def test_where_bug_mixed(self, any_signed_int_numpy_dtype):
328
328
)
329
329
330
330
expected = DataFrame (
331
- {"a" : [np .nan , np .nan , 3.0 , 4.0 ], "b" : [4.0 , 3.0 , np .nan , np .nan ]},
332
- dtype = "float64" ,
333
- )
331
+ {"a" : [- 1 , - 1 , 3 , 4 ], "b" : [4.0 , 3.0 , - 1 , - 1 ]},
332
+ ).astype ({"a" : any_signed_int_numpy_dtype , "b" : "float64" })
334
333
335
- result = df .where (df > 2 , np . nan )
334
+ result = df .where (df > 2 , - 1 )
336
335
tm .assert_frame_equal (result , expected )
337
336
338
337
result = df .copy ()
339
- return_value = result .where (result > 2 , np . nan , inplace = True )
338
+ return_value = result .where (result > 2 , - 1 , inplace = True )
340
339
assert return_value is None
341
340
tm .assert_frame_equal (result , expected )
342
341
@@ -1028,7 +1027,7 @@ def test_where_int_overflow(replacement):
1028
1027
1029
1028
def test_where_inplace_no_other ():
1030
1029
# GH#51685
1031
- df = DataFrame ({"a" : [1 , 2 ], "b" : ["x" , "y" ]})
1030
+ df = DataFrame ({"a" : [1.0 , 2.0 ], "b" : ["x" , "y" ]})
1032
1031
cond = DataFrame ({"a" : [True , False ], "b" : [False , True ]})
1033
1032
df .where (cond , inplace = True )
1034
1033
expected = DataFrame ({"a" : [1 , np .nan ], "b" : [np .nan , "y" ]})
0 commit comments