@@ -2192,6 +2192,9 @@ def is_boolean(self) -> bool:
21922192 """
21932193 Check if the Index only consists of booleans.
21942194
2195+ .. deprecated:: 2.0.0
2196+ Use `pandas.api.types.is_bool_dtype` instead.
2197+
21952198 Returns
21962199 -------
21972200 bool
@@ -2220,6 +2223,12 @@ def is_boolean(self) -> bool:
22202223 >>> idx.is_boolean()
22212224 False
22222225 """
2226+ warnings .warn (
2227+ f"{ type (self ).__name__ } .is_boolean is deprecated. "
2228+ "Use pandas.api.types.is_bool_type instead" ,
2229+ FutureWarning ,
2230+ stacklevel = find_stack_level (),
2231+ )
22232232 return self .inferred_type in ["boolean" ]
22242233
22252234 @final
@@ -2237,7 +2246,7 @@ def is_integer(self) -> bool:
22372246
22382247 See Also
22392248 --------
2240- is_boolean : Check if the Index only consists of booleans.
2249+ is_boolean : Check if the Index only consists of booleans (deprecated) .
22412250 is_floating : Check if the Index is a floating type (deprecated).
22422251 is_numeric : Check if the Index only consists of numeric data.
22432252 is_object : Check if the Index is of the object dtype.
@@ -2285,7 +2294,7 @@ def is_floating(self) -> bool:
22852294
22862295 See Also
22872296 --------
2288- is_boolean : Check if the Index only consists of booleans.
2297+ is_boolean : Check if the Index only consists of booleans (deprecated) .
22892298 is_integer : Check if the Index only consists of integers (deprecated).
22902299 is_numeric : Check if the Index only consists of numeric data.
22912300 is_object : Check if the Index is of the object dtype.
@@ -2330,7 +2339,7 @@ def is_numeric(self) -> bool:
23302339
23312340 See Also
23322341 --------
2333- is_boolean : Check if the Index only consists of booleans.
2342+ is_boolean : Check if the Index only consists of booleans (deprecated) .
23342343 is_integer : Check if the Index only consists of integers (deprecated).
23352344 is_floating : Check if the Index is a floating type (deprecated).
23362345 is_object : Check if the Index is of the object dtype.
@@ -2373,7 +2382,7 @@ def is_object(self) -> bool:
23732382
23742383 See Also
23752384 --------
2376- is_boolean : Check if the Index only consists of booleans.
2385+ is_boolean : Check if the Index only consists of booleans (deprecated) .
23772386 is_integer : Check if the Index only consists of integers (deprecated).
23782387 is_floating : Check if the Index is a floating type (deprecated).
23792388 is_numeric : Check if the Index only consists of numeric data.
@@ -2414,7 +2423,7 @@ def is_categorical(self) -> bool:
24142423 See Also
24152424 --------
24162425 CategoricalIndex : Index for categorical data.
2417- is_boolean : Check if the Index only consists of booleans.
2426+ is_boolean : Check if the Index only consists of booleans (deprecated) .
24182427 is_integer : Check if the Index only consists of integers (deprecated).
24192428 is_floating : Check if the Index is a floating type (deprecated).
24202429 is_numeric : Check if the Index only consists of numeric data.
@@ -2457,7 +2466,7 @@ def is_interval(self) -> bool:
24572466 See Also
24582467 --------
24592468 IntervalIndex : Index for Interval objects.
2460- is_boolean : Check if the Index only consists of booleans.
2469+ is_boolean : Check if the Index only consists of booleans (deprecated) .
24612470 is_integer : Check if the Index only consists of integers (deprecated).
24622471 is_floating : Check if the Index is a floating type (deprecated).
24632472 is_numeric : Check if the Index only consists of numeric data.
@@ -5874,8 +5883,8 @@ def _should_compare(self, other: Index) -> bool:
58745883 Check if `self == other` can ever have non-False entries.
58755884 """
58765885
5877- if (other . is_boolean ( ) and self .is_numeric ()) or (
5878- self . is_boolean ( ) and other .is_numeric ()
5886+ if (is_bool_dtype ( other ) and self .is_numeric ()) or (
5887+ is_bool_dtype ( self ) and other .is_numeric ()
58795888 ):
58805889 # GH#16877 Treat boolean labels passed to a numeric index as not
58815890 # found. Without this fix False and True would be treated as 0 and 1
0 commit comments