Skip to content

DEPR: deprecate Index.is_interval #50196

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

Merged
merged 15 commits into from
Jan 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
3a6cfca
assertion error fix added in pandas/core/indexes/base.py
ShisuiUzumaki Dec 13, 2022
d69d13b
Merge remote-tracking branch 'origin/main'
ShisuiUzumaki Dec 14, 2022
9ce4f09
Merge branch 'main' of https://github.com/ShisuiUzumaki/pandas
ShisuiUzumaki Dec 14, 2022
d5f0fbb
Merge branch 'main' of https://github.com/ShisuiUzumaki/pandas
ShisuiUzumaki Dec 15, 2022
c989cdb
Merge branch 'main' of https://github.com/ShisuiUzumaki/pandas
ShisuiUzumaki Jan 5, 2023
491616b
Merge branch 'main' of https://github.com/ShisuiUzumaki/pandas
ShisuiUzumaki Jan 16, 2023
c27d97c
Merge branch 'main' of https://github.com/ShisuiUzumaki/pandas
ShisuiUzumaki Jan 16, 2023
6f856a3
Merge branch 'main' of https://github.com/ShisuiUzumaki/pandas
ShisuiUzumaki Jan 23, 2023
fc26996
changes made to pandas/core/infexes/base.py for is_interval deprecati…
ShisuiUzumaki Dec 12, 2022
4e3aa15
changes made to pandas/tests//indexes/common.py to test deprecation o…
ShisuiUzumaki Dec 12, 2022
d808c25
docs/source/whatsnew/v2.0.0.rst edited for index.is_interval
ShisuiUzumaki Dec 12, 2022
57a2b11
changes in pandas/core/indexes/base.py - removed extra import of is_i…
ShisuiUzumaki Dec 12, 2022
b07cb5a
brnahc state before rebase
ShisuiUzumaki Jan 16, 2023
5cb50fa
Fixed error in .pre-commit-config.yaml file
ShisuiUzumaki Jan 23, 2023
13600da
unwanted changed fixed in .pre-commit-cofig.yaml
ShisuiUzumaki Jan 24, 2023
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/v2.0.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,7 @@ Deprecations
- :meth:`Index.is_floating` has been deprecated. Use :func:`pandas.api.types.is_float_dtype` instead (:issue:`50042`)
- :meth:`Index.holds_integer` has been deprecated. Use :func:`pandas.api.types.infer_dtype` instead (:issue:`50243`)
- :meth:`Index.is_categorical` has been deprecated. Use :func:`pandas.api.types.is_categorical_dtype` instead (:issue:`50042`)
- :meth:`Index.is_interval` has been deprecated. Use :func:`pandas.api.types.is_intterval_dtype` instead (:issue:`50042`)

.. ---------------------------------------------------------------------------
.. _whatsnew_200.prior_deprecations:
Expand Down
21 changes: 15 additions & 6 deletions pandas/core/indexes/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2209,7 +2209,7 @@ def is_boolean(self) -> bool:
is_numeric : Check if the Index only consists of numeric data.
is_object : Check if the Index is of the object dtype.
is_categorical : Check if the Index holds categorical data.
is_interval : Check if the Index holds Interval objects.
is_interval : Check if the Index holds Interval objects (deprecated).

Examples
--------
Expand Down Expand Up @@ -2253,7 +2253,7 @@ def is_integer(self) -> bool:
is_numeric : Check if the Index only consists of numeric data.
is_object : Check if the Index is of the object dtype.
is_categorical : Check if the Index holds categorical data (deprecated).
is_interval : Check if the Index holds Interval objects.
is_interval : Check if the Index holds Interval objects (deprecated).

Examples
--------
Expand Down Expand Up @@ -2301,7 +2301,7 @@ def is_floating(self) -> bool:
is_numeric : Check if the Index only consists of numeric data.
is_object : Check if the Index is of the object dtype.
is_categorical : Check if the Index holds categorical data (deprecated).
is_interval : Check if the Index holds Interval objects.
is_interval : Check if the Index holds Interval objects (deprecated).

Examples
--------
Expand Down Expand Up @@ -2346,7 +2346,7 @@ def is_numeric(self) -> bool:
is_floating : Check if the Index is a floating type (deprecated).
is_object : Check if the Index is of the object dtype.
is_categorical : Check if the Index holds categorical data (deprecated).
is_interval : Check if the Index holds Interval objects.
is_interval : Check if the Index holds Interval objects (deprecated).

Examples
--------
Expand Down Expand Up @@ -2389,7 +2389,7 @@ def is_object(self) -> bool:
is_floating : Check if the Index is a floating type (deprecated).
is_numeric : Check if the Index only consists of numeric data.
is_categorical : Check if the Index holds categorical data (deprecated).
is_interval : Check if the Index holds Interval objects.
is_interval : Check if the Index holds Interval objects (deprecated).

Examples
--------
Expand Down Expand Up @@ -2433,7 +2433,7 @@ def is_categorical(self) -> bool:
is_floating : Check if the Index is a floating type (deprecated).
is_numeric : Check if the Index only consists of numeric data.
is_object : Check if the Index is of the object dtype.
is_interval : Check if the Index holds Interval objects.
is_interval : Check if the Index holds Interval objects (deprecated).

Examples
--------
Expand Down Expand Up @@ -2470,6 +2470,9 @@ def is_interval(self) -> bool:
"""
Check if the Index holds Interval objects.

.. deprecated:: 2.0.0
Use `pandas.api.types.is_interval_dtype` instead.

Returns
-------
bool
Expand All @@ -2496,6 +2499,12 @@ def is_interval(self) -> bool:
>>> idx.is_interval()
False
"""
warnings.warn(
f"{type(self).__name__}.is_interval is deprecated."
"Use pandas.api.types.is_interval_dtype instead",
FutureWarning,
stacklevel=find_stack_level(),
)
return self.inferred_type in ["interval"]

@final
Expand Down
6 changes: 6 additions & 0 deletions pandas/tests/indexes/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -823,6 +823,12 @@ def test_is_categorical_is_deprecated(self, simple_index):
):
idx.is_categorical()

def test_is_interval_is_deprecated(self, simple_index):
# GH50042
idx = simple_index
with tm.assert_produces_warning(FutureWarning):
idx.is_interval()


class NumericBase(Base):
"""
Expand Down