Skip to content

Commit fc26996

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

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

pandas/core/indexes/base.py

+16-6
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_dtype_equal,
9495
is_ea_or_datetimelike_dtype,
@@ -2209,7 +2210,7 @@ def is_boolean(self) -> bool:
22092210
is_numeric : Check if the Index only consists of numeric data.
22102211
is_object : Check if the Index is of the object dtype.
22112212
is_categorical : Check if the Index holds categorical data.
2212-
is_interval : Check if the Index holds Interval objects.
2213+
is_interval : Check if the Index holds Interval objects (deprecated).
22132214
22142215
Examples
22152216
--------
@@ -2253,7 +2254,7 @@ def is_integer(self) -> bool:
22532254
is_numeric : Check if the Index only consists of numeric data.
22542255
is_object : Check if the Index is of the object dtype.
22552256
is_categorical : Check if the Index holds categorical data (deprecated).
2256-
is_interval : Check if the Index holds Interval objects.
2257+
is_interval : Check if the Index holds Interval objects (deprecated).
22572258
22582259
Examples
22592260
--------
@@ -2301,7 +2302,7 @@ def is_floating(self) -> bool:
23012302
is_numeric : Check if the Index only consists of numeric data.
23022303
is_object : Check if the Index is of the object dtype.
23032304
is_categorical : Check if the Index holds categorical data (deprecated).
2304-
is_interval : Check if the Index holds Interval objects.
2305+
is_interval : Check if the Index holds Interval objects (deprecated).
23052306
23062307
Examples
23072308
--------
@@ -2346,7 +2347,7 @@ def is_numeric(self) -> bool:
23462347
is_floating : Check if the Index is a floating type (deprecated).
23472348
is_object : Check if the Index is of the object dtype.
23482349
is_categorical : Check if the Index holds categorical data (deprecated).
2349-
is_interval : Check if the Index holds Interval objects.
2350+
is_interval : Check if the Index holds Interval objects (deprecated).
23502351
23512352
Examples
23522353
--------
@@ -2389,7 +2390,7 @@ def is_object(self) -> bool:
23892390
is_floating : Check if the Index is a floating type (deprecated).
23902391
is_numeric : Check if the Index only consists of numeric data.
23912392
is_categorical : Check if the Index holds categorical data (deprecated).
2392-
is_interval : Check if the Index holds Interval objects.
2393+
is_interval : Check if the Index holds Interval objects (deprecated).
23932394
23942395
Examples
23952396
--------
@@ -2433,7 +2434,7 @@ def is_categorical(self) -> bool:
24332434
is_floating : Check if the Index is a floating type (deprecated).
24342435
is_numeric : Check if the Index only consists of numeric data.
24352436
is_object : Check if the Index is of the object dtype.
2436-
is_interval : Check if the Index holds Interval objects.
2437+
is_interval : Check if the Index holds Interval objects (deprecated).
24372438
24382439
Examples
24392440
--------
@@ -2470,6 +2471,9 @@ def is_interval(self) -> bool:
24702471
"""
24712472
Check if the Index holds Interval objects.
24722473
2474+
.. deprecated:: 2.0.0
2475+
Use `pandas.api.types.is_interval_dtype` instead.
2476+
24732477
Returns
24742478
-------
24752479
bool
@@ -2496,6 +2500,12 @@ def is_interval(self) -> bool:
24962500
>>> idx.is_interval()
24972501
False
24982502
"""
2503+
warnings.warn(
2504+
f"{type(self).__name__}.is_interval is deprecated."
2505+
"Use pandas.api.types.is_interval_dtype instead",
2506+
FutureWarning,
2507+
stacklevel=find_stack_level(),
2508+
)
24992509
return self.inferred_type in ["interval"]
25002510

25012511
@final

0 commit comments

Comments
 (0)