Skip to content

Commit

Permalink
CLN: Rename raise_on_error to errors for .dtype (#23374)
Browse files Browse the repository at this point in the history
xref gh-14967.
  • Loading branch information
gfyoung authored and jreback committed Oct 28, 2018
1 parent 150b84e commit 020782a
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 13 deletions.
1 change: 1 addition & 0 deletions doc/source/whatsnew/v0.24.0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -953,6 +953,7 @@ Removal of prior version deprecations/changes
- :meth:`SparseArray.get_values` and :meth:`SparseArray.to_dense` have dropped the ``fill`` parameter (:issue:`14686`)
- :meth:`DataFrame.sortlevel` and :meth:`Series.sortlevel` have been removed (:issue:`15099`)
- :meth:`SparseSeries.to_dense` has dropped the ``sparse_only`` parameter (:issue:`14686`)
- :meth:`DataFrame.astype` and :meth:`Series.astype` have renamed the ``raise_on_error`` argument to ``errors`` (:issue:`14967`)

.. _whatsnew_0240.performance:

Expand Down
8 changes: 1 addition & 7 deletions pandas/core/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@
isidentifier, set_function_name, cPickle as pkl)
from pandas.core.ops import _align_method_FRAME
import pandas.core.nanops as nanops
from pandas.util._decorators import (Appender, Substitution,
deprecate_kwarg)
from pandas.util._decorators import Appender, Substitution
from pandas.util._validators import validate_bool_kwarg, validate_fillna_kwargs
from pandas.core import config

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

@deprecate_kwarg(old_arg_name='raise_on_error', new_arg_name='errors',
mapping={True: 'raise', False: 'ignore'})
def astype(self, dtype, copy=True, errors='raise', **kwargs):
"""
Cast a pandas object to a specified dtype ``dtype``.
Expand All @@ -5161,9 +5158,6 @@ def astype(self, dtype, copy=True, errors='raise', **kwargs):
.. versionadded:: 0.20.0
raise_on_error : raise on invalid input
.. deprecated:: 0.20.0
Use ``errors`` instead
kwargs : keyword arguments to pass on to the constructor
Returns
Expand Down
3 changes: 0 additions & 3 deletions pandas/tests/frame/test_dtypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -830,9 +830,6 @@ def test_arg_for_errors_in_astype(self):
with pytest.raises(ValueError):
df.astype(np.float64, errors=True)

with tm.assert_produces_warning(FutureWarning):
df.astype(np.int8, raise_on_error=False)

df.astype(np.int8, errors='ignore')

@pytest.mark.parametrize('input_vals', [
Expand Down
3 changes: 0 additions & 3 deletions pandas/tests/series/test_dtypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,9 +454,6 @@ def test_arg_for_errors_in_astype(self):
with pytest.raises(ValueError):
s.astype(np.float64, errors=False)

with tm.assert_produces_warning(FutureWarning):
s.astype(np.int8, raise_on_error=True)

s.astype(np.int8, errors='raise')

def test_intercept_astype_object(self):
Expand Down

0 comments on commit 020782a

Please sign in to comment.