Skip to content

Commit e79aaca

Browse files
committed
unrelated changes removed
1 parent c27d97c commit e79aaca

File tree

3 files changed

+20
-6
lines changed

3 files changed

+20
-6
lines changed

doc/source/whatsnew/v2.0.0.rst

+1
Original file line numberDiff line numberDiff line change
@@ -577,6 +577,7 @@ Deprecations
577577
- :meth:`Index.is_integer` has been deprecated. Use :func:`pandas.api.types.is_integer_dtype` instead (:issue:`50042`)
578578
- :meth:`Index.is_floating` has been deprecated. Use :func:`pandas.api.types.is_float_dtype` instead (:issue:`50042`)
579579
- :meth:`Index.holds_integer` has been deprecated. Use :func:`pandas.api.types.infer_dtype` instead (:issue:`50243`)
580+
- :meth:`Index.is_categorical` has been deprecated. Use :func:`pandas.api.types.is_categorical_dtype` instead (:issue:`50042`)
580581

581582
.. ---------------------------------------------------------------------------
582583
.. _whatsnew_200.prior_deprecations:

pandas/core/indexes/base.py

+13-6
Original file line numberDiff line numberDiff line change
@@ -2250,7 +2250,7 @@ def is_integer(self) -> bool:
22502250
is_floating : Check if the Index is a floating type (deprecated).
22512251
is_numeric : Check if the Index only consists of numeric data.
22522252
is_object : Check if the Index is of the object dtype.
2253-
is_categorical : Check if the Index holds categorical data.
2253+
is_categorical : Check if the Index holds categorical data (deprecated).
22542254
is_interval : Check if the Index holds Interval objects.
22552255
22562256
Examples
@@ -2298,7 +2298,7 @@ def is_floating(self) -> bool:
22982298
is_integer : Check if the Index only consists of integers (deprecated).
22992299
is_numeric : Check if the Index only consists of numeric data.
23002300
is_object : Check if the Index is of the object dtype.
2301-
is_categorical : Check if the Index holds categorical data.
2301+
is_categorical : Check if the Index holds categorical data (deprecated).
23022302
is_interval : Check if the Index holds Interval objects.
23032303
23042304
Examples
@@ -2343,7 +2343,7 @@ def is_numeric(self) -> bool:
23432343
is_integer : Check if the Index only consists of integers (deprecated).
23442344
is_floating : Check if the Index is a floating type (deprecated).
23452345
is_object : Check if the Index is of the object dtype.
2346-
is_categorical : Check if the Index holds categorical data.
2346+
is_categorical : Check if the Index holds categorical data (deprecated).
23472347
is_interval : Check if the Index holds Interval objects.
23482348
23492349
Examples
@@ -2386,7 +2386,7 @@ def is_object(self) -> bool:
23862386
is_integer : Check if the Index only consists of integers (deprecated).
23872387
is_floating : Check if the Index is a floating type (deprecated).
23882388
is_numeric : Check if the Index only consists of numeric data.
2389-
is_categorical : Check if the Index holds categorical data.
2389+
is_categorical : Check if the Index holds categorical data (deprecated).
23902390
is_interval : Check if the Index holds Interval objects.
23912391
23922392
Examples
@@ -2415,6 +2415,9 @@ def is_categorical(self) -> bool:
24152415
"""
24162416
Check if the Index holds categorical data.
24172417
2418+
.. deprecated:: 2.0.0
2419+
Use :meth:`pandas.api.types.is_categorical_dtype` instead.
2420+
24182421
Returns
24192422
-------
24202423
bool
@@ -2478,7 +2481,7 @@ def is_interval(self) -> bool:
24782481
is_floating : Check if the Index is a floating type (deprecated).
24792482
is_numeric : Check if the Index only consists of numeric data.
24802483
is_object : Check if the Index is of the object dtype.
2481-
is_categorical : Check if the Index holds categorical data.
2484+
is_categorical : Check if the Index holds categorical data (deprecated).
24822485
24832486
Examples
24842487
--------
@@ -5040,7 +5043,11 @@ def _can_hold_identifiers_and_holds_name(self, name) -> bool:
50405043
50415044
https://github.com/pandas-dev/pandas/issues/19764
50425045
"""
5043-
if self.is_object() or is_string_dtype(self.dtype) or self.is_categorical():
5046+
if (
5047+
self.is_object()
5048+
or is_string_dtype(self.dtype)
5049+
or is_categorical_dtype(self)
5050+
):
50445051
return name in self
50455052
return False
50465053

pandas/tests/indexes/common.py

+6
Original file line numberDiff line numberDiff line change
@@ -822,6 +822,12 @@ def test_holds_integer_deprecated(self, simple_index):
822822
with tm.assert_produces_warning(FutureWarning, match=msg):
823823
idx.holds_integer()
824824

825+
def test_is_categorical_is_deprecated(self, simple_index):
826+
# GH50042
827+
idx = simple_index
828+
with tm.assert_produces_warning(FutureWarning):
829+
idx.is_categorical()
830+
825831

826832
class NumericBase(Base):
827833
"""

0 commit comments

Comments
 (0)