From 06dcad6be055cbc487f485553eecc0a0593d181c Mon Sep 17 00:00:00 2001 From: ShreyDixit Date: Wed, 19 May 2021 10:53:39 +0000 Subject: [PATCH 1/9] passed series mask tests --- Dockerfile | 2 +- doc/source/whatsnew/v1.3.0.rst | 1 + pandas/core/generic.py | 2 ++ pandas/tests/frame/indexing/test_mask.py | 39 ++++++++++++++------- pandas/tests/series/indexing/test_mask.py | 27 ++++++++++---- pandas/tests/series/indexing/test_where.py | 2 +- path_to_file.xlsx | Bin 0 -> 5583 bytes 7 files changed, 52 insertions(+), 21 deletions(-) create mode 100644 path_to_file.xlsx diff --git a/Dockerfile b/Dockerfile index de1c564921de9..a2de794d65887 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ FROM quay.io/condaforge/miniforge3 # if you forked pandas, you can pass in your own GitHub username to use your fork # i.e. gh_username=myname -ARG gh_username=pandas-dev +ARG gh_username=ShreyDixit ARG pandas_home="/home/pandas" # Avoid warnings by switching to noninteractive diff --git a/doc/source/whatsnew/v1.3.0.rst b/doc/source/whatsnew/v1.3.0.rst index 9298bc6a61bae..2ca503faf26d9 100644 --- a/doc/source/whatsnew/v1.3.0.rst +++ b/doc/source/whatsnew/v1.3.0.rst @@ -648,6 +648,7 @@ Deprecations - Deprecated setting :attr:`Categorical._codes`, create a new :class:`Categorical` with the desired codes instead (:issue:`40606`) - Deprecated behavior of :meth:`DatetimeIndex.union` with mixed timezones; in a future version both will be cast to UTC instead of object dtype (:issue:`39328`) - Deprecated using ``usecols`` with out of bounds indices for ``read_csv`` with ``engine="c"`` (:issue:`25623`) +- Deprecated passing arguments (apart from ``cond``) as positional in :meth:`DataFrame.mask` (:issue:`41485`) .. --------------------------------------------------------------------------- diff --git a/pandas/core/generic.py b/pandas/core/generic.py index a09cc0a6324c0..93c49d73f4072 100644 --- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -62,6 +62,7 @@ ) from pandas.util._decorators import ( doc, + deprecate_nonkeyword_arguments, rewrite_axis_style_signature, ) from pandas.util._validators import ( @@ -9231,6 +9232,7 @@ def where( name="mask", name_other="where", ) + @deprecate_nonkeyword_arguments(version="2.0", allowed_args=["self", "cond"]) def mask( self, cond, diff --git a/pandas/tests/frame/indexing/test_mask.py b/pandas/tests/frame/indexing/test_mask.py index 364475428e529..71d386342a589 100644 --- a/pandas/tests/frame/indexing/test_mask.py +++ b/pandas/tests/frame/indexing/test_mask.py @@ -25,8 +25,8 @@ def test_mask(self): other = DataFrame(np.random.randn(5, 3)) rs = df.where(cond, other) - tm.assert_frame_equal(rs, df.mask(df <= 0, other)) - tm.assert_frame_equal(rs, df.mask(~cond, other)) + tm.assert_frame_equal(rs, df.mask(df <= 0, other=other)) + tm.assert_frame_equal(rs, df.mask(~cond, other=other)) # see GH#21891 df = DataFrame([1, 2]) @@ -51,7 +51,7 @@ def test_mask_inplace(self): return_value = rdf.where(cond, -df, inplace=True) assert return_value is None tm.assert_frame_equal(rdf, df.where(cond, -df)) - tm.assert_frame_equal(rdf, df.mask(~cond, -df)) + tm.assert_frame_equal(rdf, df.mask(~cond, other=-df)) def test_mask_edge_case_1xN_frame(self): # GH#4071 @@ -63,22 +63,22 @@ def test_mask_edge_case_1xN_frame(self): def test_mask_callable(self): # GH#12533 df = DataFrame([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) - result = df.mask(lambda x: x > 4, lambda x: x + 1) + result = df.mask(lambda x: x > 4, other=lambda x: x + 1) exp = DataFrame([[1, 2, 3], [4, 6, 7], [8, 9, 10]]) tm.assert_frame_equal(result, exp) - tm.assert_frame_equal(result, df.mask(df > 4, df + 1)) + tm.assert_frame_equal(result, df.mask(df > 4, other=df + 1)) # return ndarray and scalar - result = df.mask(lambda x: (x % 2 == 0).values, lambda x: 99) + result = df.mask(lambda x: (x % 2 == 0).values, other=lambda x: 99) exp = DataFrame([[1, 99, 3], [99, 5, 99], [7, 99, 9]]) tm.assert_frame_equal(result, exp) - tm.assert_frame_equal(result, df.mask(df % 2 == 0, 99)) + tm.assert_frame_equal(result, df.mask(df % 2 == 0, other=99)) # chain - result = (df + 2).mask(lambda x: x > 8, lambda x: x + 10) + result = (df + 2).mask(lambda x: x > 8, other=lambda x: x + 10) exp = DataFrame([[3, 4, 5], [6, 7, 8], [19, 20, 21]]) tm.assert_frame_equal(result, exp) - tm.assert_frame_equal(result, (df + 2).mask((df + 2) > 8, (df + 2) + 10)) + tm.assert_frame_equal(result, (df + 2).mask((df + 2) > 8, other=(df + 2) + 10)) def test_mask_dtype_bool_conversion(self): # GH#3733 @@ -90,6 +90,21 @@ def test_mask_dtype_bool_conversion(self): result = bools.mask(mask) tm.assert_frame_equal(result, expected) + def test_mask_pos_args_deprecation(self): + # https://github.com/pandas-dev/pandas/issues/41485 + df = DataFrame(np.random.randn(5, 5)) + cond = df > 0 + other = DataFrame(np.random.randn(5, 3)) + + msg = ( + r"Starting with Pandas version 2\.0 all arguments of mask except for the " + r"arguments 'self' and 'cond' will be keyword-only" + ) + with tm.assert_produces_warning(FutureWarning, match=msg): + df.mask(cond, other) + + # tm.assert_frame_equal(df.mask(cond, other), df.mask(cond, other=other)) + def test_mask_try_cast_deprecated(frame_or_series): @@ -101,7 +116,7 @@ def test_mask_try_cast_deprecated(frame_or_series): with tm.assert_produces_warning(FutureWarning): # try_cast keyword deprecated - obj.mask(mask, -1, try_cast=True) + obj.mask(mask, other=-1, try_cast=True) def test_mask_stringdtype(): @@ -115,11 +130,11 @@ def test_mask_stringdtype(): {"A": ["this", "that"]}, index=["id2", "id3"], dtype=StringDtype() ) filter_ser = Series([False, True, True, False]) - result = df.mask(filter_ser, filtered_df) + result = df.mask(filter_ser, other=filtered_df) expected = DataFrame( {"A": [NA, "this", "that", NA]}, index=["id1", "id2", "id3", "id4"], dtype=StringDtype(), ) - tm.assert_frame_equal(result, expected) + tm.assert_frame_equal(result, expected) \ No newline at end of file diff --git a/pandas/tests/series/indexing/test_mask.py b/pandas/tests/series/indexing/test_mask.py index a4dda3a5c0c5b..c870f50c90f49 100644 --- a/pandas/tests/series/indexing/test_mask.py +++ b/pandas/tests/series/indexing/test_mask.py @@ -22,7 +22,7 @@ def test_mask(): tm.assert_series_equal(rs, rs2) rs = s.where(~cond, -s) - rs2 = s.mask(cond, -s) + rs2 = s.mask(cond, other=-s) tm.assert_series_equal(rs, rs2) cond = Series([True, False, False, True, False], index=s.index) @@ -32,18 +32,18 @@ def test_mask(): tm.assert_series_equal(rs, rs2) rs = s2.where(~cond[:3], -s2) - rs2 = s2.mask(cond[:3], -s2) + rs2 = s2.mask(cond[:3], other=-s2) tm.assert_series_equal(rs, rs2) msg = "Array conditional must be same shape as self" with pytest.raises(ValueError, match=msg): s.mask(1) with pytest.raises(ValueError, match=msg): - s.mask(cond[:3].values, -s) + s.mask(cond[:3].values, other=-s) # dtype changes s = Series([1, 2, 3, 4]) - result = s.mask(s > 2, np.nan) + result = s.mask(s > 2, other=np.nan) expected = Series([1, 2, np.nan, np.nan]) tm.assert_series_equal(result, expected) @@ -65,8 +65,8 @@ def test_mask_inplace(): tm.assert_series_equal(rs, s.mask(cond)) rs = s.copy() - rs.mask(cond, -s, inplace=True) - tm.assert_series_equal(rs, s.mask(cond, -s)) + rs.mask(cond, other=-s, inplace=True) + tm.assert_series_equal(rs, s.mask(cond, other=-s)) def test_mask_stringdtype(): @@ -78,7 +78,7 @@ def test_mask_stringdtype(): ) filtered_ser = Series(["this", "that"], index=["id2", "id3"], dtype=StringDtype()) filter_ser = Series([False, True, True, False]) - result = ser.mask(filter_ser, filtered_ser) + result = ser.mask(filter_ser, other=filtered_ser) expected = Series( [NA, "this", "that", NA], @@ -86,3 +86,16 @@ def test_mask_stringdtype(): dtype=StringDtype(), ) tm.assert_series_equal(result, expected) + + +def test_mask_pos_args_deprecation(): + # https://github.com/pandas-dev/pandas/issues/41485 + df = Series(np.random.randn(6)) + cond = df > 0 + + msg = ( + r"Starting with Pandas version 2\.0 all arguments of mask except for the " + r"arguments 'self' and 'cond' will be keyword-only" + ) + with tm.assert_produces_warning(FutureWarning, match=msg): + df.mask(cond, np.nan) diff --git a/pandas/tests/series/indexing/test_where.py b/pandas/tests/series/indexing/test_where.py index b13fd18405839..0c72b84cd3562 100644 --- a/pandas/tests/series/indexing/test_where.py +++ b/pandas/tests/series/indexing/test_where.py @@ -314,7 +314,7 @@ def test_broadcast(size, mask, item, box): tm.assert_series_equal(result, expected) s = Series(data) - result = s.mask(selection, box(item)) + result = s.mask(selection, other=box(item)) tm.assert_series_equal(result, expected) diff --git a/path_to_file.xlsx b/path_to_file.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..8ab33de9ae6a4928fc0ce83b3553e726471fdc35 GIT binary patch literal 5583 zcmZ`-1z1#D*B(GxYDfWx4rOHM5Jb9>ZfS-bYUmJY38g_A5s*$PrBQ|y5b2>oS{bB4 z;2W>c|J^J9{pQR$=Q+=F-gWlg?^^F#duga(-Jk#f0C)g5mA6{BQfijL=%*U=Ns2zL zU92?VF0Sqn3s+ZeA19bv>;pnfUQ*esez(>}sZME2$q}vUS`vRcNW8U7t#n|UXlI-= z$c09Jfx!0eatZOh2%WeU=0p+zC3SSeBaWvR=xnS^@O44!-`7gWn-XX{KE7# zwM*hy`CK?LsKV#b+E$G#l;cAo6E@Km+-bgKOmLU|FqL5fC1!7`@yBolcGNRQ(Zig_ z007ATIb16jIP}+eKP5;xc1et)XnLuDB=aK~2#u|MK)cXLp%zWcc`+q|~g=^rRXk zDNV^{Z#8bnZJ8||DkSdN)P8D+0o04K=IreUK0Ud;zEzLQE2AK**q_w!^>L+PB&!68 z9k8K7EcCK4HN2opDd?8EA~FMLZ-P8qygRQ$7KM-bL)Lk@f$~m@^Gw5m1>L}aI2-;f zog0}IwhGxya7Ryvkd0TXp5qMfo2YOgJ=P>LpX?By)*4(8HXWDM&rQC8_qG8Wju|M@8b=*y49d(du`(y1Mi>>Dj|vaX*hAC=RS8 zqO7p{O9Q(SSKFEDBf0ABPfkx%_)WJ?76N}BOq#XvV5JZT?2RWa@G zI;S)tVd2#r1I)fy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HP$j?fnMl8%JSH zbkfTs(&iaV>Pk#TwiN-TS_8K+7%zjD6Rai8`x9}V=RzPyKKcFGeA)M_-~*sRfku88 zS7a6&7@lIUk60eJTZS7Out108FU)aMt4}Okn#Femc0=4RCGV+bzV+BSHo+0hs4gbD zz$GYcNnrZ|al!T}=Cu6+-e(|NXm^uNdJEpGmEGo~2QvQ%LEX4)F%`51X#%I%IDBf~ zlxQ-%X9dXy$S`ZrIm89nTw%^7vr$zG$mL6FtIvh(U^?hqd^0F`7m^ho85~vR_<5fx zcPpYHJC9+i9`E#0bl^fQ_24Dg-dqp>)Od}vw|p$Jdw$F=I_$_2-FVD5h+*dG)5A6=6z}+#4}H4=A>) z*7x9}dUpDTuTo!JK|fSiuE-&b6R&dd=w>>?|4lDPOgpKXZawzA+TM=aBE;P1)}&@= zuhwe+cyCmgri)d`S3Gro!{~C=f`NXGuJ&+dbgkcjV`D?kBE*>s%NarNUe9ODQm+~*Z?XI81)CP*lca*zNSTWJQ zK6yovN+j}vPZmXAA_LDj5&ot#1}*b`r8n@k^=>E!Dp|XVNobp+_;6n9Xm(F1W05eS z<8?2n=VOj8-tBzBLiX6Q(5g1gALLT-ukoQTqM8YwQU z>uFtwU+)3^4X;Lj{$Dym*9~0XWBk`Za02dM2L5%&aox)GLiTSfaQuI@@>f}V-OBZ% z>AzMmRME-cj}q!S^m^j>8yZUdM;f^fye`Cl17T=gMt}345^x=ST{r#)pP?J5Xz>3~ lk?VG@$K>C3*3g~Je~C~H6>OYeFA<=RFtlh1{_6h${sa91rKkV^ literal 0 HcmV?d00001 From 696337443156ff3a9446501956c1603d1e996e29 Mon Sep 17 00:00:00 2001 From: Shrey Dixit Date: Thu, 20 May 2021 05:46:00 +0000 Subject: [PATCH 2/9] Updated stack level for try_cast deprecate warning --- pandas/core/generic.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/core/generic.py b/pandas/core/generic.py index 93c49d73f4072..cc2f2493844f6 100644 --- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -9252,7 +9252,7 @@ def mask( "try_cast keyword is deprecated and will be removed in a " "future version", FutureWarning, - stacklevel=2, + stacklevel=3, ) # see gh-21891 From e406b0fcb083a5f620e267f24342ef5a5528c2ff Mon Sep 17 00:00:00 2001 From: Shrey Dixit Date: Thu, 20 May 2021 06:21:53 +0000 Subject: [PATCH 3/9] check equality of frames and series --- pandas/tests/frame/indexing/test_mask.py | 6 ++---- pandas/tests/series/indexing/test_mask.py | 6 +++--- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/pandas/tests/frame/indexing/test_mask.py b/pandas/tests/frame/indexing/test_mask.py index 71d386342a589..e68e170bf5057 100644 --- a/pandas/tests/frame/indexing/test_mask.py +++ b/pandas/tests/frame/indexing/test_mask.py @@ -101,9 +101,7 @@ def test_mask_pos_args_deprecation(self): r"arguments 'self' and 'cond' will be keyword-only" ) with tm.assert_produces_warning(FutureWarning, match=msg): - df.mask(cond, other) - - # tm.assert_frame_equal(df.mask(cond, other), df.mask(cond, other=other)) + tm.assert_frame_equal(df.mask(cond, other), df.mask(cond, other=other)) def test_mask_try_cast_deprecated(frame_or_series): @@ -137,4 +135,4 @@ def test_mask_stringdtype(): index=["id1", "id2", "id3", "id4"], dtype=StringDtype(), ) - tm.assert_frame_equal(result, expected) \ No newline at end of file + tm.assert_frame_equal(result, expected) diff --git a/pandas/tests/series/indexing/test_mask.py b/pandas/tests/series/indexing/test_mask.py index c870f50c90f49..6bf870e86c3ae 100644 --- a/pandas/tests/series/indexing/test_mask.py +++ b/pandas/tests/series/indexing/test_mask.py @@ -90,12 +90,12 @@ def test_mask_stringdtype(): def test_mask_pos_args_deprecation(): # https://github.com/pandas-dev/pandas/issues/41485 - df = Series(np.random.randn(6)) - cond = df > 0 + s = Series(np.random.randn(6)) + cond = s > 0 msg = ( r"Starting with Pandas version 2\.0 all arguments of mask except for the " r"arguments 'self' and 'cond' will be keyword-only" ) with tm.assert_produces_warning(FutureWarning, match=msg): - df.mask(cond, np.nan) + tm.assert_series_equal(s.mask(cond, np.nan), s.mask(cond, other=np.nan)) From 6e72701bc9d5337f99d7038838d6ec20c746f8a2 Mon Sep 17 00:00:00 2001 From: Shrey Dixit Date: Thu, 20 May 2021 07:24:13 +0000 Subject: [PATCH 4/9] rechanged dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index a2de794d65887..de1c564921de9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ FROM quay.io/condaforge/miniforge3 # if you forked pandas, you can pass in your own GitHub username to use your fork # i.e. gh_username=myname -ARG gh_username=ShreyDixit +ARG gh_username=pandas-dev ARG pandas_home="/home/pandas" # Avoid warnings by switching to noninteractive From f7be5e0f5bb142cc076480614e30e297af7f5ac3 Mon Sep 17 00:00:00 2001 From: Shrey Dixit Date: Mon, 24 May 2021 14:12:59 +0000 Subject: [PATCH 5/9] added other to allowed pos args in mask --- pandas/core/generic.py | 6 ++++-- pandas/tests/frame/indexing/test_mask.py | 11 +++++------ pandas/tests/series/indexing/test_mask.py | 11 +++++------ 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/pandas/core/generic.py b/pandas/core/generic.py index cc2f2493844f6..692ac8b10ad36 100644 --- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -61,8 +61,8 @@ InvalidIndexError, ) from pandas.util._decorators import ( - doc, deprecate_nonkeyword_arguments, + doc, rewrite_axis_style_signature, ) from pandas.util._validators import ( @@ -9232,7 +9232,9 @@ def where( name="mask", name_other="where", ) - @deprecate_nonkeyword_arguments(version="2.0", allowed_args=["self", "cond"]) + @deprecate_nonkeyword_arguments( + version=None, allowed_args=["self", "cond", "other"] + ) def mask( self, cond, diff --git a/pandas/tests/frame/indexing/test_mask.py b/pandas/tests/frame/indexing/test_mask.py index e68e170bf5057..eeeb0f9276197 100644 --- a/pandas/tests/frame/indexing/test_mask.py +++ b/pandas/tests/frame/indexing/test_mask.py @@ -96,12 +96,11 @@ def test_mask_pos_args_deprecation(self): cond = df > 0 other = DataFrame(np.random.randn(5, 3)) - msg = ( - r"Starting with Pandas version 2\.0 all arguments of mask except for the " - r"arguments 'self' and 'cond' will be keyword-only" - ) - with tm.assert_produces_warning(FutureWarning, match=msg): - tm.assert_frame_equal(df.mask(cond, other), df.mask(cond, other=other)) + with tm.assert_produces_warning(FutureWarning): + result = df.mask(cond, other, False) + + expected = df.mask(cond, other=other, inplace=False) + tm.assert_frame_equal(result, expected) def test_mask_try_cast_deprecated(frame_or_series): diff --git a/pandas/tests/series/indexing/test_mask.py b/pandas/tests/series/indexing/test_mask.py index 6bf870e86c3ae..178c2376ef718 100644 --- a/pandas/tests/series/indexing/test_mask.py +++ b/pandas/tests/series/indexing/test_mask.py @@ -93,9 +93,8 @@ def test_mask_pos_args_deprecation(): s = Series(np.random.randn(6)) cond = s > 0 - msg = ( - r"Starting with Pandas version 2\.0 all arguments of mask except for the " - r"arguments 'self' and 'cond' will be keyword-only" - ) - with tm.assert_produces_warning(FutureWarning, match=msg): - tm.assert_series_equal(s.mask(cond, np.nan), s.mask(cond, other=np.nan)) + with tm.assert_produces_warning(FutureWarning): + result = s.mask(cond, np.nan, False) + + expected = s.mask(cond, other=np.nan, inplace=False) + tm.assert_series_equal(result, expected) From 4840f66636c5047727dcd595f4036d03e744a628 Mon Sep 17 00:00:00 2001 From: Shrey Dixit Date: Tue, 25 May 2021 14:55:28 +0000 Subject: [PATCH 6/9] Added message to mask deprec test --- pandas/tests/frame/indexing/test_mask.py | 17 +++++++++++------ pandas/tests/series/indexing/test_mask.py | 15 ++++++++++----- path_to_file.xlsx | Bin 5583 -> 0 bytes 3 files changed, 21 insertions(+), 11 deletions(-) delete mode 100644 path_to_file.xlsx diff --git a/pandas/tests/frame/indexing/test_mask.py b/pandas/tests/frame/indexing/test_mask.py index eeeb0f9276197..f1eec3661c39a 100644 --- a/pandas/tests/frame/indexing/test_mask.py +++ b/pandas/tests/frame/indexing/test_mask.py @@ -92,14 +92,19 @@ def test_mask_dtype_bool_conversion(self): def test_mask_pos_args_deprecation(self): # https://github.com/pandas-dev/pandas/issues/41485 - df = DataFrame(np.random.randn(5, 5)) - cond = df > 0 - other = DataFrame(np.random.randn(5, 3)) + df = DataFrame({"a": range(5)}) + + expected = DataFrame({"a": [-1, 1, -1, 3, -1]}) + cond = df % 2 == 0 + + msg = ( + r"In a future version of pandas all arguments of NDFrame.mask except for " + r"the arguments 'cond' and 'other' will be keyword-only" + ) - with tm.assert_produces_warning(FutureWarning): - result = df.mask(cond, other, False) + with tm.assert_produces_warning(FutureWarning, match=msg): + result = df.mask(cond, -1, False) - expected = df.mask(cond, other=other, inplace=False) tm.assert_frame_equal(result, expected) diff --git a/pandas/tests/series/indexing/test_mask.py b/pandas/tests/series/indexing/test_mask.py index 178c2376ef718..f646d5a487c3e 100644 --- a/pandas/tests/series/indexing/test_mask.py +++ b/pandas/tests/series/indexing/test_mask.py @@ -90,11 +90,16 @@ def test_mask_stringdtype(): def test_mask_pos_args_deprecation(): # https://github.com/pandas-dev/pandas/issues/41485 - s = Series(np.random.randn(6)) - cond = s > 0 + s = Series(range(5)) + expected = Series([-1, 1, -1, 3, -1]) + cond = s % 2 == 0 + + msg = ( + r"In a future version of pandas all arguments of NDFrame.mask except for " + r"the arguments 'cond' and 'other' will be keyword-only" + ) - with tm.assert_produces_warning(FutureWarning): - result = s.mask(cond, np.nan, False) + with tm.assert_produces_warning(FutureWarning, match=msg): + result = s.mask(cond, -1, False) - expected = s.mask(cond, other=np.nan, inplace=False) tm.assert_series_equal(result, expected) diff --git a/path_to_file.xlsx b/path_to_file.xlsx deleted file mode 100644 index 8ab33de9ae6a4928fc0ce83b3553e726471fdc35..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5583 zcmZ`-1z1#D*B(GxYDfWx4rOHM5Jb9>ZfS-bYUmJY38g_A5s*$PrBQ|y5b2>oS{bB4 z;2W>c|J^J9{pQR$=Q+=F-gWlg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d`S3Gro!{~C=f`NXGuJ&+dbgkcjV`D?kBE*>s%NarNUe9ODQm+~*Z?XI81)CP*lca*zNSTWJQ zK6yovN+j}vPZmXAA_LDj5&ot#1}*b`r8n@k^=>E!Dp|XVNobp+_;6n9Xm(F1W05eS z<8?2n=VOj8-tBzBLiX6Q(5g1gALLT-ukoQTqM8YwQU z>uFtwU+)3^4X;Lj{$Dym*9~0XWBk`Za02dM2L5%&aox)GLiTSfaQuI@@>f}V-OBZ% z>AzMmRME-cj}q!S^m^j>8yZUdM;f^fye`Cl17T=gMt}345^x=ST{r#)pP?J5Xz>3~ lk?VG@$K>C3*3g~Je~C~H6>OYeFA<=RFtlh1{_6h${sa91rKkV^ From 78616473feea2e072ed428a4787c2693127556be Mon Sep 17 00:00:00 2001 From: Marco Gorelli Date: Wed, 26 May 2021 21:19:53 +0100 Subject: [PATCH 7/9] fixup --- pandas/tests/frame/indexing/test_mask.py | 22 +++++++++++----------- pandas/tests/series/indexing/test_mask.py | 14 +++++++------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/pandas/tests/frame/indexing/test_mask.py b/pandas/tests/frame/indexing/test_mask.py index f1eec3661c39a..ea50c25414b48 100644 --- a/pandas/tests/frame/indexing/test_mask.py +++ b/pandas/tests/frame/indexing/test_mask.py @@ -25,8 +25,8 @@ def test_mask(self): other = DataFrame(np.random.randn(5, 3)) rs = df.where(cond, other) - tm.assert_frame_equal(rs, df.mask(df <= 0, other=other)) - tm.assert_frame_equal(rs, df.mask(~cond, other=other)) + tm.assert_frame_equal(rs, df.mask(df <= 0, other)) + tm.assert_frame_equal(rs, df.mask(~cond, other)) # see GH#21891 df = DataFrame([1, 2]) @@ -51,7 +51,7 @@ def test_mask_inplace(self): return_value = rdf.where(cond, -df, inplace=True) assert return_value is None tm.assert_frame_equal(rdf, df.where(cond, -df)) - tm.assert_frame_equal(rdf, df.mask(~cond, other=-df)) + tm.assert_frame_equal(rdf, df.mask(~cond, -df)) def test_mask_edge_case_1xN_frame(self): # GH#4071 @@ -63,22 +63,22 @@ def test_mask_edge_case_1xN_frame(self): def test_mask_callable(self): # GH#12533 df = DataFrame([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) - result = df.mask(lambda x: x > 4, other=lambda x: x + 1) + result = df.mask(lambda x: x > 4, lambda x: x + 1) exp = DataFrame([[1, 2, 3], [4, 6, 7], [8, 9, 10]]) tm.assert_frame_equal(result, exp) - tm.assert_frame_equal(result, df.mask(df > 4, other=df + 1)) + tm.assert_frame_equal(result, df.mask(df > 4, df + 1)) # return ndarray and scalar - result = df.mask(lambda x: (x % 2 == 0).values, other=lambda x: 99) + result = df.mask(lambda x: (x % 2 == 0).values, lambda x: 99) exp = DataFrame([[1, 99, 3], [99, 5, 99], [7, 99, 9]]) tm.assert_frame_equal(result, exp) - tm.assert_frame_equal(result, df.mask(df % 2 == 0, other=99)) + tm.assert_frame_equal(result, df.mask(df % 2 == 0, 99)) # chain - result = (df + 2).mask(lambda x: x > 8, other=lambda x: x + 10) + result = (df + 2).mask(lambda x: x > 8, lambda x: x + 10) exp = DataFrame([[3, 4, 5], [6, 7, 8], [19, 20, 21]]) tm.assert_frame_equal(result, exp) - tm.assert_frame_equal(result, (df + 2).mask((df + 2) > 8, other=(df + 2) + 10)) + tm.assert_frame_equal(result, (df + 2).mask((df + 2) > 8, (df + 2) + 10)) def test_mask_dtype_bool_conversion(self): # GH#3733 @@ -118,7 +118,7 @@ def test_mask_try_cast_deprecated(frame_or_series): with tm.assert_produces_warning(FutureWarning): # try_cast keyword deprecated - obj.mask(mask, other=-1, try_cast=True) + obj.mask(mask, -1, try_cast=True) def test_mask_stringdtype(): @@ -132,7 +132,7 @@ def test_mask_stringdtype(): {"A": ["this", "that"]}, index=["id2", "id3"], dtype=StringDtype() ) filter_ser = Series([False, True, True, False]) - result = df.mask(filter_ser, other=filtered_df) + result = df.mask(filter_ser, filtered_df) expected = DataFrame( {"A": [NA, "this", "that", NA]}, diff --git a/pandas/tests/series/indexing/test_mask.py b/pandas/tests/series/indexing/test_mask.py index f646d5a487c3e..6e9ee2e7d6188 100644 --- a/pandas/tests/series/indexing/test_mask.py +++ b/pandas/tests/series/indexing/test_mask.py @@ -22,7 +22,7 @@ def test_mask(): tm.assert_series_equal(rs, rs2) rs = s.where(~cond, -s) - rs2 = s.mask(cond, other=-s) + rs2 = s.mask(cond, -s) tm.assert_series_equal(rs, rs2) cond = Series([True, False, False, True, False], index=s.index) @@ -32,18 +32,18 @@ def test_mask(): tm.assert_series_equal(rs, rs2) rs = s2.where(~cond[:3], -s2) - rs2 = s2.mask(cond[:3], other=-s2) + rs2 = s2.mask(cond[:3], -s2) tm.assert_series_equal(rs, rs2) msg = "Array conditional must be same shape as self" with pytest.raises(ValueError, match=msg): s.mask(1) with pytest.raises(ValueError, match=msg): - s.mask(cond[:3].values, other=-s) + s.mask(cond[:3].values, -s) # dtype changes s = Series([1, 2, 3, 4]) - result = s.mask(s > 2, other=np.nan) + result = s.mask(s > 2, np.nan) expected = Series([1, 2, np.nan, np.nan]) tm.assert_series_equal(result, expected) @@ -65,8 +65,8 @@ def test_mask_inplace(): tm.assert_series_equal(rs, s.mask(cond)) rs = s.copy() - rs.mask(cond, other=-s, inplace=True) - tm.assert_series_equal(rs, s.mask(cond, other=-s)) + rs.mask(cond, -s, inplace=True) + tm.assert_series_equal(rs, s.mask(cond, -s)) def test_mask_stringdtype(): @@ -78,7 +78,7 @@ def test_mask_stringdtype(): ) filtered_ser = Series(["this", "that"], index=["id2", "id3"], dtype=StringDtype()) filter_ser = Series([False, True, True, False]) - result = ser.mask(filter_ser, other=filtered_ser) + result = ser.mask(filter_ser, filtered_ser) expected = Series( [NA, "this", "that", NA], From 31c98c14ac8047af96df979213e97f1c27ea039c Mon Sep 17 00:00:00 2001 From: Marco Gorelli Date: Wed, 26 May 2021 21:24:44 +0100 Subject: [PATCH 8/9] fixup --- pandas/core/frame.py | 15 +++++++++++++++ pandas/core/generic.py | 6 +----- pandas/core/series.py | 15 +++++++++++++++ pandas/tests/frame/indexing/test_mask.py | 6 +----- pandas/tests/series/indexing/test_mask.py | 5 +---- pandas/tests/series/indexing/test_where.py | 2 +- 6 files changed, 34 insertions(+), 15 deletions(-) diff --git a/pandas/core/frame.py b/pandas/core/frame.py index 748a103a89965..983a00f377d89 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -10697,6 +10697,21 @@ def where( ): return super().where(cond, other, inplace, axis, level, errors, try_cast) + @deprecate_nonkeyword_arguments( + version=None, allowed_args=["self", "cond", "other"] + ) + def mask( + self, + cond, + other=np.nan, + inplace=False, + axis=None, + level=None, + errors="raise", + try_cast=lib.no_default, + ): + return super().mask(cond, other, inplace, axis, level, errors, try_cast) + DataFrame._add_numeric_operations() diff --git a/pandas/core/generic.py b/pandas/core/generic.py index 41fd714f60199..1d57bafda9587 100644 --- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -61,7 +61,6 @@ InvalidIndexError, ) from pandas.util._decorators import ( - deprecate_nonkeyword_arguments, doc, rewrite_axis_style_signature, ) @@ -9126,9 +9125,6 @@ def where( name="mask", name_other="where", ) - @deprecate_nonkeyword_arguments( - version=None, allowed_args=["self", "cond", "other"] - ) def mask( self, cond, @@ -9148,7 +9144,7 @@ def mask( "try_cast keyword is deprecated and will be removed in a " "future version", FutureWarning, - stacklevel=3, + stacklevel=4, ) # see gh-21891 diff --git a/pandas/core/series.py b/pandas/core/series.py index ce38e1ccb2613..3dc54976753f5 100644 --- a/pandas/core/series.py +++ b/pandas/core/series.py @@ -5343,6 +5343,21 @@ def where( ): return super().where(cond, other, inplace, axis, level, errors, try_cast) + @deprecate_nonkeyword_arguments( + version=None, allowed_args=["self", "cond", "other"] + ) + def mask( + self, + cond, + other=np.nan, + inplace=False, + axis=None, + level=None, + errors="raise", + try_cast=lib.no_default, + ): + return super().mask(cond, other, inplace, axis, level, errors, try_cast) + # ---------------------------------------------------------------------- # Add index _AXIS_ORDERS = ["index"] diff --git a/pandas/tests/frame/indexing/test_mask.py b/pandas/tests/frame/indexing/test_mask.py index ea50c25414b48..ac80426883dd5 100644 --- a/pandas/tests/frame/indexing/test_mask.py +++ b/pandas/tests/frame/indexing/test_mask.py @@ -93,18 +93,14 @@ def test_mask_dtype_bool_conversion(self): def test_mask_pos_args_deprecation(self): # https://github.com/pandas-dev/pandas/issues/41485 df = DataFrame({"a": range(5)}) - expected = DataFrame({"a": [-1, 1, -1, 3, -1]}) cond = df % 2 == 0 - msg = ( - r"In a future version of pandas all arguments of NDFrame.mask except for " + r"In a future version of pandas all arguments of DataFrame.mask except for " r"the arguments 'cond' and 'other' will be keyword-only" ) - with tm.assert_produces_warning(FutureWarning, match=msg): result = df.mask(cond, -1, False) - tm.assert_frame_equal(result, expected) diff --git a/pandas/tests/series/indexing/test_mask.py b/pandas/tests/series/indexing/test_mask.py index 6e9ee2e7d6188..30a9d925ed7e5 100644 --- a/pandas/tests/series/indexing/test_mask.py +++ b/pandas/tests/series/indexing/test_mask.py @@ -93,13 +93,10 @@ def test_mask_pos_args_deprecation(): s = Series(range(5)) expected = Series([-1, 1, -1, 3, -1]) cond = s % 2 == 0 - msg = ( - r"In a future version of pandas all arguments of NDFrame.mask except for " + r"In a future version of pandas all arguments of Series.mask except for " r"the arguments 'cond' and 'other' will be keyword-only" ) - with tm.assert_produces_warning(FutureWarning, match=msg): result = s.mask(cond, -1, False) - tm.assert_series_equal(result, expected) diff --git a/pandas/tests/series/indexing/test_where.py b/pandas/tests/series/indexing/test_where.py index 702faf8f2db24..0c6b9bd924759 100644 --- a/pandas/tests/series/indexing/test_where.py +++ b/pandas/tests/series/indexing/test_where.py @@ -328,7 +328,7 @@ def test_broadcast(size, mask, item, box): tm.assert_series_equal(result, expected) s = Series(data) - result = s.mask(selection, other=box(item)) + result = s.mask(selection, box(item)) tm.assert_series_equal(result, expected) From 698389a0a6061360c713bd197256f2f1cba70344 Mon Sep 17 00:00:00 2001 From: Shrey Dixit Date: Thu, 27 May 2021 05:19:44 +0000 Subject: [PATCH 9/9] changed whats new --- doc/source/whatsnew/v1.3.0.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/whatsnew/v1.3.0.rst b/doc/source/whatsnew/v1.3.0.rst index b029e4b84c118..c9b137bd1f657 100644 --- a/doc/source/whatsnew/v1.3.0.rst +++ b/doc/source/whatsnew/v1.3.0.rst @@ -679,7 +679,7 @@ Deprecations - Deprecated the ``convert_float`` optional argument in :func:`read_excel` and :meth:`ExcelFile.parse` (:issue:`41127`) - Deprecated behavior of :meth:`DatetimeIndex.union` with mixed timezones; in a future version both will be cast to UTC instead of object dtype (:issue:`39328`) - Deprecated using ``usecols`` with out of bounds indices for ``read_csv`` with ``engine="c"`` (:issue:`25623`) -- Deprecated passing arguments (apart from ``cond`` and ``other``) as positional in :meth:`DataFrame.mask` (:issue:`41485`) +- Deprecated passing arguments (apart from ``cond`` and ``other``) as positional in :meth:`DataFrame.mask` and :meth:`Series.mask` (:issue:`41485`) - Deprecated passing arguments as positional in :meth:`DataFrame.clip` and :meth:`Series.clip` (other than ``"upper"`` and ``"lower"``) (:issue:`41485`) - Deprecated special treatment of lists with first element a Categorical in the :class:`DataFrame` constructor; pass as ``pd.DataFrame({col: categorical, ...})`` instead (:issue:`38845`) - Deprecated passing arguments as positional (except for ``"method"``) in :meth:`DataFrame.interpolate` and :meth:`Series.interpolate` (:issue:`41485`)