Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLN: Rename raise_on_error to errors for .dtype #23374

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -948,6 +948,7 @@ Removal of prior version deprecations/changes
- Removal of the previously deprecated module ``pandas.json`` (:issue:`19944`)
- :meth:`SparseArray.get_values` and :meth:`SparseArray.to_dense` have dropped the ``fill`` parameter (:issue:`14686`)
- :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 @@ -5148,8 +5147,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 @@ -5173,9 +5170,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