Skip to content

Commit fbbec97

Browse files
committed
changes made to pandas/core/infexes/base.py for is_interval deprecation in class Index
1 parent a0ee90a commit fbbec97

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

pandas/core/indexes/base.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@
8989
ensure_object,
9090
ensure_platform_int,
9191
is_bool_dtype,
92+
is_interval_dtype,
9293
is_categorical_dtype,
9394
is_complex_dtype,
9495
is_dtype_equal,
@@ -2205,7 +2206,7 @@ def is_boolean(self) -> bool:
22052206
is_numeric : Check if the Index only consists of numeric data.
22062207
is_object : Check if the Index is of the object dtype.
22072208
is_categorical : Check if the Index holds categorical data.
2208-
is_interval : Check if the Index holds Interval objects.
2209+
is_interval : Check if the Index holds Interval objects (deprecated).
22092210
22102211
Examples
22112212
--------
@@ -2240,7 +2241,7 @@ def is_integer(self) -> bool:
22402241
is_numeric : Check if the Index only consists of numeric data.
22412242
is_object : Check if the Index is of the object dtype.
22422243
is_categorical : Check if the Index holds categorical data.
2243-
is_interval : Check if the Index holds Interval objects.
2244+
is_interval : Check if the Index holds Interval objects (deprecated).
22442245
22452246
Examples
22462247
--------
@@ -2279,7 +2280,7 @@ def is_floating(self) -> bool:
22792280
is_numeric : Check if the Index only consists of numeric data.
22802281
is_object : Check if the Index is of the object dtype.
22812282
is_categorical : Check if the Index holds categorical data.
2282-
is_interval : Check if the Index holds Interval objects.
2283+
is_interval : Check if the Index holds Interval objects (deprecated).
22832284
22842285
Examples
22852286
--------
@@ -2361,7 +2362,7 @@ def is_object(self) -> bool:
23612362
is_floating : Check if the Index is a floating type.
23622363
is_numeric : Check if the Index only consists of numeric data.
23632364
is_categorical : Check if the Index holds categorical data.
2364-
is_interval : Check if the Index holds Interval objects.
2365+
is_interval : Check if the Index holds Interval objects (deprecated).
23652366
23662367
Examples
23672368
--------
@@ -2402,7 +2403,7 @@ def is_categorical(self) -> bool:
24022403
is_floating : Check if the Index is a floating type.
24032404
is_numeric : Check if the Index only consists of numeric data.
24042405
is_object : Check if the Index is of the object dtype.
2405-
is_interval : Check if the Index holds Interval objects.
2406+
is_interval : Check if the Index holds Interval objects (deprecated).
24062407
24072408
Examples
24082409
--------
@@ -2432,6 +2433,9 @@ def is_interval(self) -> bool:
24322433
"""
24332434
Check if the Index holds Interval objects.
24342435
2436+
.. deprecated:: 2.0.0
2437+
Use `pandas.api.types.is_interval_dtype` instead.
2438+
24352439
Returns
24362440
-------
24372441
bool
@@ -2458,6 +2462,12 @@ def is_interval(self) -> bool:
24582462
>>> idx.is_interval()
24592463
False
24602464
"""
2465+
warnings.warn(
2466+
f"{type(self).__name__}.is_interval is deprecated."
2467+
"Use pandas.api.types.is_interval_dtype instead",
2468+
FutureWarning,
2469+
stacklevel=find_stack_level(),
2470+
)
24612471
return self.inferred_type in ["interval"]
24622472

24632473
@final

0 commit comments

Comments
 (0)