Skip to content

Commit

Permalink
CLN: Rename raise_on_error to errors for .dtype
Browse files Browse the repository at this point in the history
  • Loading branch information
gfyoung committed Oct 27, 2018
1 parent caea25a commit 234bf2c
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 11 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 @@ -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
5 changes: 0 additions & 5 deletions pandas/core/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -5148,8 +5148,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 +5171,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 234bf2c

Please sign in to comment.