From b723a66a50d79f7a590fbbcdd73b4f8a5f185786 Mon Sep 17 00:00:00 2001 From: Matt Roeschke Date: Wed, 25 Dec 2019 12:53:13 -0800 Subject: [PATCH 1/3] DEPR. Change RangeIndex.start/stop/step to FutureWarning --- pandas/core/indexes/range.py | 6 +++--- pandas/tests/indexes/test_range.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pandas/core/indexes/range.py b/pandas/core/indexes/range.py index 6ad70841a48b0..bb6e82c747cfc 100644 --- a/pandas/core/indexes/range.py +++ b/pandas/core/indexes/range.py @@ -225,7 +225,7 @@ def _start(self): """ warnings.warn( self._deprecation_message.format("_start", "start"), - DeprecationWarning, + FutureWarning, stacklevel=2, ) return self.start @@ -248,7 +248,7 @@ def _stop(self): # GH 25710 warnings.warn( self._deprecation_message.format("_stop", "stop"), - DeprecationWarning, + FutureWarning, stacklevel=2, ) return self.stop @@ -272,7 +272,7 @@ def _step(self): # GH 25710 warnings.warn( self._deprecation_message.format("_step", "step"), - DeprecationWarning, + FutureWarning, stacklevel=2, ) return self.step diff --git a/pandas/tests/indexes/test_range.py b/pandas/tests/indexes/test_range.py index 13b8ca2a8ea22..5e1ebf8653fe6 100644 --- a/pandas/tests/indexes/test_range.py +++ b/pandas/tests/indexes/test_range.py @@ -209,7 +209,7 @@ def test_start_stop_step_attrs(self, index, start, stop, step): def test_deprecated_start_stop_step_attrs(self, attr_name): # GH 26581 idx = self.create_index() - with tm.assert_produces_warning(DeprecationWarning): + with tm.assert_produces_warning(FutureWarning): getattr(idx, attr_name) def test_copy(self): From 4cd8f6cff0af4ef8d90ddc124a9bf9f8562e0678 Mon Sep 17 00:00:00 2001 From: Matt Roeschke Date: Wed, 25 Dec 2019 22:34:13 -0800 Subject: [PATCH 2/3] Add whatsnew --- doc/source/whatsnew/v1.0.0.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/whatsnew/v1.0.0.rst b/doc/source/whatsnew/v1.0.0.rst index faca744a8f92c..7647952f8d915 100644 --- a/doc/source/whatsnew/v1.0.0.rst +++ b/doc/source/whatsnew/v1.0.0.rst @@ -503,7 +503,7 @@ Deprecations Usage of ``json_normalize`` as ``pandas.io.json.json_normalize`` is now deprecated and it is recommended to use ``json_normalize`` as :func:`pandas.json_normalize` instead (:issue:`27586`). - :meth:`DataFrame.to_stata`, :meth:`DataFrame.to_feather`, and :meth:`DataFrame.to_parquet` argument "fname" is deprecated, use "path" instead (:issue:`23574`) - +- The deprecated internal attributes ``_start``, ``_stop`` and ``_step`` attributes of :class:`RangeIndex` now raise a ``FutureWarning`` instead of a ``DeprecationWarning`` (:issue:`26581`) .. _whatsnew_1000.prior_deprecations: From cfc088b729bab93f1f6635c43dd324fb610323b1 Mon Sep 17 00:00:00 2001 From: Matt Roeschke Date: Thu, 26 Dec 2019 09:51:12 -0800 Subject: [PATCH 3/3] Modify wording in whatsnew --- doc/source/whatsnew/v1.0.0.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/whatsnew/v1.0.0.rst b/doc/source/whatsnew/v1.0.0.rst index 95c576735980f..ff1fcb0b9a308 100644 --- a/doc/source/whatsnew/v1.0.0.rst +++ b/doc/source/whatsnew/v1.0.0.rst @@ -503,7 +503,7 @@ Deprecations Usage of ``json_normalize`` as ``pandas.io.json.json_normalize`` is now deprecated and it is recommended to use ``json_normalize`` as :func:`pandas.json_normalize` instead (:issue:`27586`). - :meth:`DataFrame.to_stata`, :meth:`DataFrame.to_feather`, and :meth:`DataFrame.to_parquet` argument "fname" is deprecated, use "path" instead (:issue:`23574`) -- The deprecated internal attributes ``_start``, ``_stop`` and ``_step`` attributes of :class:`RangeIndex` now raise a ``FutureWarning`` instead of a ``DeprecationWarning`` (:issue:`26581`) +- The deprecated internal attributes ``_start``, ``_stop`` and ``_step`` of :class:`RangeIndex` now raise a ``FutureWarning`` instead of a ``DeprecationWarning`` (:issue:`26581`) .. _whatsnew_1000.prior_deprecations: