Skip to content

Commit 7861647

Browse files
committed
fixup
1 parent 9f7adc6 commit 7861647

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

pandas/tests/frame/indexing/test_mask.py

+11-11
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ def test_mask(self):
2525

2626
other = DataFrame(np.random.randn(5, 3))
2727
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))
3030

3131
# see GH#21891
3232
df = DataFrame([1, 2])
@@ -51,7 +51,7 @@ def test_mask_inplace(self):
5151
return_value = rdf.where(cond, -df, inplace=True)
5252
assert return_value is None
5353
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))
5555

5656
def test_mask_edge_case_1xN_frame(self):
5757
# GH#4071
@@ -63,22 +63,22 @@ def test_mask_edge_case_1xN_frame(self):
6363
def test_mask_callable(self):
6464
# GH#12533
6565
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)
6767
exp = DataFrame([[1, 2, 3], [4, 6, 7], [8, 9, 10]])
6868
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))
7070

7171
# 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)
7373
exp = DataFrame([[1, 99, 3], [99, 5, 99], [7, 99, 9]])
7474
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))
7676

7777
# 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)
7979
exp = DataFrame([[3, 4, 5], [6, 7, 8], [19, 20, 21]])
8080
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))
8282

8383
def test_mask_dtype_bool_conversion(self):
8484
# GH#3733
@@ -118,7 +118,7 @@ def test_mask_try_cast_deprecated(frame_or_series):
118118

119119
with tm.assert_produces_warning(FutureWarning):
120120
# try_cast keyword deprecated
121-
obj.mask(mask, other=-1, try_cast=True)
121+
obj.mask(mask, -1, try_cast=True)
122122

123123

124124
def test_mask_stringdtype():
@@ -132,7 +132,7 @@ def test_mask_stringdtype():
132132
{"A": ["this", "that"]}, index=["id2", "id3"], dtype=StringDtype()
133133
)
134134
filter_ser = Series([False, True, True, False])
135-
result = df.mask(filter_ser, other=filtered_df)
135+
result = df.mask(filter_ser, filtered_df)
136136

137137
expected = DataFrame(
138138
{"A": [NA, "this", "that", NA]},

pandas/tests/series/indexing/test_mask.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def test_mask():
2222
tm.assert_series_equal(rs, rs2)
2323

2424
rs = s.where(~cond, -s)
25-
rs2 = s.mask(cond, other=-s)
25+
rs2 = s.mask(cond, -s)
2626
tm.assert_series_equal(rs, rs2)
2727

2828
cond = Series([True, False, False, True, False], index=s.index)
@@ -32,18 +32,18 @@ def test_mask():
3232
tm.assert_series_equal(rs, rs2)
3333

3434
rs = s2.where(~cond[:3], -s2)
35-
rs2 = s2.mask(cond[:3], other=-s2)
35+
rs2 = s2.mask(cond[:3], -s2)
3636
tm.assert_series_equal(rs, rs2)
3737

3838
msg = "Array conditional must be same shape as self"
3939
with pytest.raises(ValueError, match=msg):
4040
s.mask(1)
4141
with pytest.raises(ValueError, match=msg):
42-
s.mask(cond[:3].values, other=-s)
42+
s.mask(cond[:3].values, -s)
4343

4444
# dtype changes
4545
s = Series([1, 2, 3, 4])
46-
result = s.mask(s > 2, other=np.nan)
46+
result = s.mask(s > 2, np.nan)
4747
expected = Series([1, 2, np.nan, np.nan])
4848
tm.assert_series_equal(result, expected)
4949

@@ -65,8 +65,8 @@ def test_mask_inplace():
6565
tm.assert_series_equal(rs, s.mask(cond))
6666

6767
rs = s.copy()
68-
rs.mask(cond, other=-s, inplace=True)
69-
tm.assert_series_equal(rs, s.mask(cond, other=-s))
68+
rs.mask(cond, -s, inplace=True)
69+
tm.assert_series_equal(rs, s.mask(cond, -s))
7070

7171

7272
def test_mask_stringdtype():
@@ -78,7 +78,7 @@ def test_mask_stringdtype():
7878
)
7979
filtered_ser = Series(["this", "that"], index=["id2", "id3"], dtype=StringDtype())
8080
filter_ser = Series([False, True, True, False])
81-
result = ser.mask(filter_ser, other=filtered_ser)
81+
result = ser.mask(filter_ser, filtered_ser)
8282

8383
expected = Series(
8484
[NA, "this", "that", NA],

0 commit comments

Comments
 (0)