Skip to content

Commit 4335abd

Browse files
gfyoungtm9k1
authored andcommitted
CLN: Rename raise_on_error to errors for .dtype (pandas-dev#23374)
xref pandas-devgh-14967.
1 parent 429bc0d commit 4335abd

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
@@ -954,6 +954,7 @@ Removal of prior version deprecations/changes
954954
- :meth:`SparseArray.get_values` and :meth:`SparseArray.to_dense` have dropped the ``fill`` parameter (:issue:`14686`)
955955
- :meth:`DataFrame.sortlevel` and :meth:`Series.sortlevel` have been removed (:issue:`15099`)
956956
- :meth:`SparseSeries.to_dense` has dropped the ``sparse_only`` parameter (:issue:`14686`)
957+
- :meth:`DataFrame.astype` and :meth:`Series.astype` have renamed the ``raise_on_error`` argument to ``errors`` (:issue:`14967`)
957958

958959
.. _whatsnew_0240.performance:
959960

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

@@ -5136,8 +5135,6 @@ def _to_dict_of_blocks(self, copy=True):
51365135
return {k: self._constructor(v).__finalize__(self)
51375136
for k, v, in self._data.to_dict(copy=copy).items()}
51385137

5139-
@deprecate_kwarg(old_arg_name='raise_on_error', new_arg_name='errors',
5140-
mapping={True: 'raise', False: 'ignore'})
51415138
def astype(self, dtype, copy=True, errors='raise', **kwargs):
51425139
"""
51435140
Cast a pandas object to a specified dtype ``dtype``.
@@ -5161,9 +5158,6 @@ def astype(self, dtype, copy=True, errors='raise', **kwargs):
51615158
51625159
.. versionadded:: 0.20.0
51635160
5164-
raise_on_error : raise on invalid input
5165-
.. deprecated:: 0.20.0
5166-
Use ``errors`` instead
51675161
kwargs : keyword arguments to pass on to the constructor
51685162
51695163
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)