Skip to content

Commit e432d2a

Browse files
authored
DEPR: un-deprecate errors kwd reverts #44294 (#45334)
1 parent 50ac498 commit e432d2a

File tree

4 files changed

+12
-27
lines changed

4 files changed

+12
-27
lines changed

doc/source/whatsnew/v1.4.0.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,6 @@ Other Deprecations
614614
- Deprecated silent dropping of columns that raised a ``TypeError``, ``DataError``, and some cases of ``ValueError`` in :meth:`Series.aggregate`, :meth:`DataFrame.aggregate`, :meth:`Series.groupby.aggregate`, and :meth:`DataFrame.groupby.aggregate` when used with a list (:issue:`43740`)
615615
- Deprecated casting behavior when setting timezone-aware value(s) into a timezone-aware :class:`Series` or :class:`DataFrame` column when the timezones do not match. Previously this cast to object dtype. In a future version, the values being inserted will be converted to the series or column's existing timezone (:issue:`37605`)
616616
- Deprecated casting behavior when passing an item with mismatched-timezone to :meth:`DatetimeIndex.insert`, :meth:`DatetimeIndex.putmask`, :meth:`DatetimeIndex.where` :meth:`DatetimeIndex.fillna`, :meth:`Series.mask`, :meth:`Series.where`, :meth:`Series.fillna`, :meth:`Series.shift`, :meth:`Series.replace`, :meth:`Series.reindex` (and :class:`DataFrame` column analogues). In the past this has cast to object dtype. In a future version, these will cast the passed item to the index or series's timezone (:issue:`37605`,:issue:`44940`)
617-
- Deprecated the 'errors' keyword argument in :meth:`Series.where`, :meth:`DataFrame.where`, :meth:`Series.mask`, and :meth:`DataFrame.mask`; in a future version the argument will be removed (:issue:`44294`)
618617
- Deprecated the ``prefix`` keyword argument in :func:`read_csv` and :func:`read_table`, in a future version the argument will be removed (:issue:`43396`)
619618
- Deprecated passing non boolean argument to sort in :func:`concat` (:issue:`41518`)
620619
- Deprecated passing arguments as positional for :func:`read_fwf` other than ``filepath_or_buffer`` (:issue:`41485`):

pandas/core/frame.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10933,7 +10933,7 @@ def where(
1093310933
inplace=False,
1093410934
axis=None,
1093510935
level=None,
10936-
errors=lib.no_default,
10936+
errors="raise",
1093710937
try_cast=lib.no_default,
1093810938
):
1093910939
return super().where(cond, other, inplace, axis, level, errors, try_cast)
@@ -10948,7 +10948,7 @@ def mask(
1094810948
inplace=False,
1094910949
axis=None,
1095010950
level=None,
10951-
errors=lib.no_default,
10951+
errors="raise",
1095210952
try_cast=lib.no_default,
1095310953
):
1095410954
return super().mask(cond, other, inplace, axis, level, errors, try_cast)

pandas/core/generic.py

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9009,22 +9009,14 @@ def _where(
90099009
inplace=False,
90109010
axis=None,
90119011
level=None,
9012-
errors=lib.no_default,
9012+
errors="raise",
90139013
):
90149014
"""
90159015
Equivalent to public method `where`, except that `other` is not
90169016
applied as a function even if callable. Used in __setitem__.
90179017
"""
90189018
inplace = validate_bool_kwarg(inplace, "inplace")
90199019

9020-
if errors is not lib.no_default:
9021-
warnings.warn(
9022-
f"The 'errors' keyword in {type(self).__name__}.where and mask is "
9023-
"deprecated and will be removed in a future version.",
9024-
FutureWarning,
9025-
stacklevel=find_stack_level(),
9026-
)
9027-
90289020
if axis is not None:
90299021
axis = self._get_axis_number(axis)
90309022

@@ -9160,7 +9152,7 @@ def where(
91609152
inplace=False,
91619153
axis=None,
91629154
level=None,
9163-
errors=lib.no_default,
9155+
errors="raise",
91649156
try_cast=lib.no_default,
91659157
):
91669158
"""
@@ -9193,9 +9185,6 @@ def where(
91939185
- 'raise' : allow exceptions to be raised.
91949186
- 'ignore' : suppress exceptions. On error return original object.
91959187
9196-
.. deprecated:: 1.4.0
9197-
Previously was silently ignored.
9198-
91999188
try_cast : bool, default None
92009189
Try to cast the result back to the input type (if possible).
92019190
@@ -9316,7 +9305,7 @@ def mask(
93169305
inplace=False,
93179306
axis=None,
93189307
level=None,
9319-
errors=lib.no_default,
9308+
errors="raise",
93209309
try_cast=lib.no_default,
93219310
):
93229311

pandas/tests/series/methods/test_fillna.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -151,18 +151,15 @@ def test_fillna_consistency(self):
151151
)
152152
tm.assert_series_equal(result, expected)
153153

154-
msg = "The 'errors' keyword in "
155-
with tm.assert_produces_warning(FutureWarning, match=msg):
156-
# where (we ignore the errors=)
157-
result = ser.where(
158-
[True, False], Timestamp("20130101", tz="US/Eastern"), errors="ignore"
159-
)
154+
# where (we ignore the errors=)
155+
result = ser.where(
156+
[True, False], Timestamp("20130101", tz="US/Eastern"), errors="ignore"
157+
)
160158
tm.assert_series_equal(result, expected)
161159

162-
with tm.assert_produces_warning(FutureWarning, match=msg):
163-
result = ser.where(
164-
[True, False], Timestamp("20130101", tz="US/Eastern"), errors="ignore"
165-
)
160+
result = ser.where(
161+
[True, False], Timestamp("20130101", tz="US/Eastern"), errors="ignore"
162+
)
166163
tm.assert_series_equal(result, expected)
167164

168165
# with a non-datetime

0 commit comments

Comments
 (0)