Skip to content

Commit 7f3efe2

Browse files
mroeschkeAlexKirko
authored andcommitted
DEPR. Change RangeIndex._start/_stop/_step to FutureWarning (pandas-dev#30482)
* DEPR. Change RangeIndex.start/stop/step to FutureWarning * Add whatsnew * Modify wording in whatsnew
1 parent 807c0cd commit 7f3efe2

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

doc/source/whatsnew/v1.0.0.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ Deprecations
503503
Usage of ``json_normalize`` as ``pandas.io.json.json_normalize`` is now deprecated and
504504
it is recommended to use ``json_normalize`` as :func:`pandas.json_normalize` instead (:issue:`27586`).
505505
- :meth:`DataFrame.to_stata`, :meth:`DataFrame.to_feather`, and :meth:`DataFrame.to_parquet` argument "fname" is deprecated, use "path" instead (:issue:`23574`)
506-
506+
- The deprecated internal attributes ``_start``, ``_stop`` and ``_step`` of :class:`RangeIndex` now raise a ``FutureWarning`` instead of a ``DeprecationWarning`` (:issue:`26581`)
507507

508508
.. _whatsnew_1000.prior_deprecations:
509509

pandas/core/indexes/range.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ def _start(self):
225225
"""
226226
warnings.warn(
227227
self._deprecation_message.format("_start", "start"),
228-
DeprecationWarning,
228+
FutureWarning,
229229
stacklevel=2,
230230
)
231231
return self.start
@@ -248,7 +248,7 @@ def _stop(self):
248248
# GH 25710
249249
warnings.warn(
250250
self._deprecation_message.format("_stop", "stop"),
251-
DeprecationWarning,
251+
FutureWarning,
252252
stacklevel=2,
253253
)
254254
return self.stop
@@ -272,7 +272,7 @@ def _step(self):
272272
# GH 25710
273273
warnings.warn(
274274
self._deprecation_message.format("_step", "step"),
275-
DeprecationWarning,
275+
FutureWarning,
276276
stacklevel=2,
277277
)
278278
return self.step

pandas/tests/indexes/ranges/test_range.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def test_start_stop_step_attrs(self, index, start, stop, step):
6464
def test_deprecated_start_stop_step_attrs(self, attr_name):
6565
# GH 26581
6666
idx = self.create_index()
67-
with tm.assert_produces_warning(DeprecationWarning):
67+
with tm.assert_produces_warning(FutureWarning):
6868
getattr(idx, attr_name)
6969

7070
def test_copy(self):

0 commit comments

Comments
 (0)