@@ -2238,7 +2238,7 @@ def is_integer(self) -> bool:
22382238 is_floating : Check if the Index is a floating type.
22392239 is_numeric : Check if the Index only consists of numeric data.
22402240 is_object : Check if the Index is of the object dtype.
2241- is_categorical : Check if the Index holds categorical data.
2241+ is_categorical : Check if the Index holds categorical data (deprecated) .
22422242 is_interval : Check if the Index holds Interval objects.
22432243
22442244 Examples
@@ -2277,7 +2277,7 @@ def is_floating(self) -> bool:
22772277 is_integer : Check if the Index only consists of integers.
22782278 is_numeric : Check if the Index only consists of numeric data.
22792279 is_object : Check if the Index is of the object dtype.
2280- is_categorical : Check if the Index holds categorical data.
2280+ is_categorical : Check if the Index holds categorical data (deprecated) .
22812281 is_interval : Check if the Index holds Interval objects.
22822282
22832283 Examples
@@ -2316,7 +2316,7 @@ def is_numeric(self) -> bool:
23162316 is_integer : Check if the Index only consists of integers.
23172317 is_floating : Check if the Index is a floating type.
23182318 is_object : Check if the Index is of the object dtype.
2319- is_categorical : Check if the Index holds categorical data.
2319+ is_categorical : Check if the Index holds categorical data (deprecated) .
23202320 is_interval : Check if the Index holds Interval objects.
23212321
23222322 Examples
@@ -2359,7 +2359,7 @@ def is_object(self) -> bool:
23592359 is_integer : Check if the Index only consists of integers.
23602360 is_floating : Check if the Index is a floating type.
23612361 is_numeric : Check if the Index only consists of numeric data.
2362- is_categorical : Check if the Index holds categorical data.
2362+ is_categorical : Check if the Index holds categorical data (deprecated) .
23632363 is_interval : Check if the Index holds Interval objects.
23642364
23652365 Examples
@@ -2388,6 +2388,9 @@ def is_categorical(self) -> bool:
23882388 """
23892389 Check if the Index holds categorical data.
23902390
2391+ .. deprecated:: 2.0.0
2392+ Use :meth:`pandas.api.types.is_categorical_dtype` instead.
2393+
23912394 Returns
23922395 -------
23932396 bool
@@ -2424,6 +2427,12 @@ def is_categorical(self) -> bool:
24242427 >>> s.index.is_categorical()
24252428 False
24262429 """
2430+ warnings .warn (
2431+ f"{ type (self ).__name__ } .is_categorical is deprecated."
2432+ "Use pandas.api.types.is_categorical_dtype instead" ,
2433+ FutureWarning ,
2434+ stacklevel = find_stack_level (),
2435+ )
24272436 return self .inferred_type in ["categorical" ]
24282437
24292438 @final
@@ -2444,7 +2453,7 @@ def is_interval(self) -> bool:
24442453 is_floating : Check if the Index is a floating type.
24452454 is_numeric : Check if the Index only consists of numeric data.
24462455 is_object : Check if the Index is of the object dtype.
2447- is_categorical : Check if the Index holds categorical data.
2456+ is_categorical : Check if the Index holds categorical data (deprecated) .
24482457
24492458 Examples
24502459 --------
@@ -5014,7 +5023,11 @@ def _can_hold_identifiers_and_holds_name(self, name) -> bool:
50145023
50155024 https://github.com/pandas-dev/pandas/issues/19764
50165025 """
5017- if self .is_object () or is_string_dtype (self .dtype ) or self .is_categorical ():
5026+ if (
5027+ self .is_object ()
5028+ or is_string_dtype (self .dtype )
5029+ or is_categorical_dtype (self )
5030+ ):
50185031 return name in self
50195032 return False
50205033
0 commit comments