@@ -2193,6 +2193,9 @@ def is_boolean(self) -> bool:
21932193 """
21942194 Check if the Index only consists of booleans.
21952195
2196+ .. deprecated:: 2.0.0
2197+ Use `pandas.api.types.is_bool_dtype` instead.
2198+
21962199 Returns
21972200 -------
21982201 bool
@@ -2221,6 +2224,12 @@ def is_boolean(self) -> bool:
22212224 >>> idx.is_boolean()
22222225 False
22232226 """
2227+ warnings .warn (
2228+ f"{ type (self ).__name__ } .is_boolean is deprecated."
2229+ "Use pandas.api.types.is_bool_type instead" ,
2230+ FutureWarning ,
2231+ stacklevel = find_stack_level (),
2232+ )
22242233 return self .inferred_type in ["boolean" ]
22252234
22262235 @final
@@ -2235,7 +2244,7 @@ def is_integer(self) -> bool:
22352244
22362245 See Also
22372246 --------
2238- is_boolean : Check if the Index only consists of booleans.
2247+ is_boolean : Check if the Index only consists of booleans (deprecated) .
22392248 is_floating : Check if the Index is a floating type.
22402249 is_numeric : Check if the Index only consists of numeric data.
22412250 is_object : Check if the Index is of the object dtype.
@@ -2274,7 +2283,7 @@ def is_floating(self) -> bool:
22742283
22752284 See Also
22762285 --------
2277- is_boolean : Check if the Index only consists of booleans.
2286+ is_boolean : Check if the Index only consists of booleans (deprecated) .
22782287 is_integer : Check if the Index only consists of integers.
22792288 is_numeric : Check if the Index only consists of numeric data.
22802289 is_object : Check if the Index is of the object dtype.
@@ -2313,7 +2322,7 @@ def is_numeric(self) -> bool:
23132322
23142323 See Also
23152324 --------
2316- is_boolean : Check if the Index only consists of booleans.
2325+ is_boolean : Check if the Index only consists of booleans (deprecated) .
23172326 is_integer : Check if the Index only consists of integers.
23182327 is_floating : Check if the Index is a floating type.
23192328 is_object : Check if the Index is of the object dtype.
@@ -2356,7 +2365,7 @@ def is_object(self) -> bool:
23562365
23572366 See Also
23582367 --------
2359- is_boolean : Check if the Index only consists of booleans.
2368+ is_boolean : Check if the Index only consists of booleans (deprecated) .
23602369 is_integer : Check if the Index only consists of integers.
23612370 is_floating : Check if the Index is a floating type.
23622371 is_numeric : Check if the Index only consists of numeric data.
@@ -2397,7 +2406,7 @@ def is_categorical(self) -> bool:
23972406 See Also
23982407 --------
23992408 CategoricalIndex : Index for categorical data.
2400- is_boolean : Check if the Index only consists of booleans.
2409+ is_boolean : Check if the Index only consists of booleans (deprecated) .
24012410 is_integer : Check if the Index only consists of integers.
24022411 is_floating : Check if the Index is a floating type.
24032412 is_numeric : Check if the Index only consists of numeric data.
@@ -2440,7 +2449,7 @@ def is_interval(self) -> bool:
24402449 See Also
24412450 --------
24422451 IntervalIndex : Index for Interval objects.
2443- is_boolean : Check if the Index only consists of booleans.
2452+ is_boolean : Check if the Index only consists of booleans (deprecated) .
24442453 is_integer : Check if the Index only consists of integers.
24452454 is_floating : Check if the Index is a floating type.
24462455 is_numeric : Check if the Index only consists of numeric data.
@@ -5855,8 +5864,8 @@ def _should_compare(self, other: Index) -> bool:
58555864 Check if `self == other` can ever have non-False entries.
58565865 """
58575866
5858- if (other . is_boolean ( ) and self .is_numeric ()) or (
5859- self . is_boolean ( ) and other .is_numeric ()
5867+ if (is_bool_dtype ( other ) and self .is_numeric ()) or (
5868+ is_bool_dtype ( self ) and other .is_numeric ()
58605869 ):
58615870 # GH#16877 Treat boolean labels passed to a numeric index as not
58625871 # found. Without this fix False and True would be treated as 0 and 1
0 commit comments