Skip to content

Commit 6fb1cec

Browse files
committed
CLN: Rename raise_on_error to errors for .dtype
xref pandas-devgh-14967.
1 parent caea25a commit 6fb1cec

File tree

4 files changed

+2
-13
lines changed

4 files changed

+2
-13
lines changed

doc/source/whatsnew/v0.24.0.txt

+1
Original file line numberDiff line numberDiff line change
@@ -948,6 +948,7 @@ Removal of prior version deprecations/changes
948948
- Removal of the previously deprecated module ``pandas.json`` (:issue:`19944`)
949949
- :meth:`SparseArray.get_values` and :meth:`SparseArray.to_dense` have dropped the ``fill`` parameter (:issue:`14686`)
950950
- :meth:`SparseSeries.to_dense` has dropped the ``sparse_only`` parameter (:issue:`14686`)
951+
- :meth:`DataFrame.astype` and :meth:`Series.astype` have renamed the ``raise_on_error`` argument to ``errors`` (:issue:`14967`)
951952

952953
.. _whatsnew_0240.performance:
953954

pandas/core/generic.py

+1-7
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,7 @@
5353
isidentifier, set_function_name, cPickle as pkl)
5454
from pandas.core.ops import _align_method_FRAME
5555
import pandas.core.nanops as nanops
56-
from pandas.util._decorators import (Appender, Substitution,
57-
deprecate_kwarg)
56+
from pandas.util._decorators import Appender, Substitution
5857
from pandas.util._validators import validate_bool_kwarg, validate_fillna_kwargs
5958
from pandas.core import config
6059

@@ -5148,8 +5147,6 @@ def _to_dict_of_blocks(self, copy=True):
51485147
return {k: self._constructor(v).__finalize__(self)
51495148
for k, v, in self._data.to_dict(copy=copy).items()}
51505149

5151-
@deprecate_kwarg(old_arg_name='raise_on_error', new_arg_name='errors',
5152-
mapping={True: 'raise', False: 'ignore'})
51535150
def astype(self, dtype, copy=True, errors='raise', **kwargs):
51545151
"""
51555152
Cast a pandas object to a specified dtype ``dtype``.
@@ -5173,9 +5170,6 @@ def astype(self, dtype, copy=True, errors='raise', **kwargs):
51735170
51745171
.. versionadded:: 0.20.0
51755172
5176-
raise_on_error : raise on invalid input
5177-
.. deprecated:: 0.20.0
5178-
Use ``errors`` instead
51795173
kwargs : keyword arguments to pass on to the constructor
51805174
51815175
Returns

pandas/tests/frame/test_dtypes.py

-3
Original file line numberDiff line numberDiff line change
@@ -830,9 +830,6 @@ def test_arg_for_errors_in_astype(self):
830830
with pytest.raises(ValueError):
831831
df.astype(np.float64, errors=True)
832832

833-
with tm.assert_produces_warning(FutureWarning):
834-
df.astype(np.int8, raise_on_error=False)
835-
836833
df.astype(np.int8, errors='ignore')
837834

838835
@pytest.mark.parametrize('input_vals', [

pandas/tests/series/test_dtypes.py

-3
Original file line numberDiff line numberDiff line change
@@ -454,9 +454,6 @@ def test_arg_for_errors_in_astype(self):
454454
with pytest.raises(ValueError):
455455
s.astype(np.float64, errors=False)
456456

457-
with tm.assert_produces_warning(FutureWarning):
458-
s.astype(np.int8, raise_on_error=True)
459-
460457
s.astype(np.int8, errors='raise')
461458

462459
def test_intercept_astype_object(self):

0 commit comments

Comments
 (0)