@@ -25,8 +25,8 @@ def test_mask(self):
25
25
26
26
other = DataFrame (np .random .randn (5 , 3 ))
27
27
rs = df .where (cond , other )
28
- tm .assert_frame_equal (rs , df .mask (df <= 0 , other = other ))
29
- tm .assert_frame_equal (rs , df .mask (~ cond , other = other ))
28
+ tm .assert_frame_equal (rs , df .mask (df <= 0 , other ))
29
+ tm .assert_frame_equal (rs , df .mask (~ cond , other ))
30
30
31
31
# see GH#21891
32
32
df = DataFrame ([1 , 2 ])
@@ -51,7 +51,7 @@ def test_mask_inplace(self):
51
51
return_value = rdf .where (cond , - df , inplace = True )
52
52
assert return_value is None
53
53
tm .assert_frame_equal (rdf , df .where (cond , - df ))
54
- tm .assert_frame_equal (rdf , df .mask (~ cond , other = - df ))
54
+ tm .assert_frame_equal (rdf , df .mask (~ cond , - df ))
55
55
56
56
def test_mask_edge_case_1xN_frame (self ):
57
57
# GH#4071
@@ -63,22 +63,22 @@ def test_mask_edge_case_1xN_frame(self):
63
63
def test_mask_callable (self ):
64
64
# GH#12533
65
65
df = DataFrame ([[1 , 2 , 3 ], [4 , 5 , 6 ], [7 , 8 , 9 ]])
66
- result = df .mask (lambda x : x > 4 , other = lambda x : x + 1 )
66
+ result = df .mask (lambda x : x > 4 , lambda x : x + 1 )
67
67
exp = DataFrame ([[1 , 2 , 3 ], [4 , 6 , 7 ], [8 , 9 , 10 ]])
68
68
tm .assert_frame_equal (result , exp )
69
- tm .assert_frame_equal (result , df .mask (df > 4 , other = df + 1 ))
69
+ tm .assert_frame_equal (result , df .mask (df > 4 , df + 1 ))
70
70
71
71
# return ndarray and scalar
72
- result = df .mask (lambda x : (x % 2 == 0 ).values , other = lambda x : 99 )
72
+ result = df .mask (lambda x : (x % 2 == 0 ).values , lambda x : 99 )
73
73
exp = DataFrame ([[1 , 99 , 3 ], [99 , 5 , 99 ], [7 , 99 , 9 ]])
74
74
tm .assert_frame_equal (result , exp )
75
- tm .assert_frame_equal (result , df .mask (df % 2 == 0 , other = 99 ))
75
+ tm .assert_frame_equal (result , df .mask (df % 2 == 0 , 99 ))
76
76
77
77
# chain
78
- result = (df + 2 ).mask (lambda x : x > 8 , other = lambda x : x + 10 )
78
+ result = (df + 2 ).mask (lambda x : x > 8 , lambda x : x + 10 )
79
79
exp = DataFrame ([[3 , 4 , 5 ], [6 , 7 , 8 ], [19 , 20 , 21 ]])
80
80
tm .assert_frame_equal (result , exp )
81
- tm .assert_frame_equal (result , (df + 2 ).mask ((df + 2 ) > 8 , other = (df + 2 ) + 10 ))
81
+ tm .assert_frame_equal (result , (df + 2 ).mask ((df + 2 ) > 8 , (df + 2 ) + 10 ))
82
82
83
83
def test_mask_dtype_bool_conversion (self ):
84
84
# GH#3733
@@ -118,7 +118,7 @@ def test_mask_try_cast_deprecated(frame_or_series):
118
118
119
119
with tm .assert_produces_warning (FutureWarning ):
120
120
# try_cast keyword deprecated
121
- obj .mask (mask , other = - 1 , try_cast = True )
121
+ obj .mask (mask , - 1 , try_cast = True )
122
122
123
123
124
124
def test_mask_stringdtype ():
@@ -132,7 +132,7 @@ def test_mask_stringdtype():
132
132
{"A" : ["this" , "that" ]}, index = ["id2" , "id3" ], dtype = StringDtype ()
133
133
)
134
134
filter_ser = Series ([False , True , True , False ])
135
- result = df .mask (filter_ser , other = filtered_df )
135
+ result = df .mask (filter_ser , filtered_df )
136
136
137
137
expected = DataFrame (
138
138
{"A" : [NA , "this" , "that" , NA ]},
0 commit comments