Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 4e4dbc4

Browse files
committedNov 28, 2020
Fixes
1 parent d8bdb2e commit 4e4dbc4

File tree

4 files changed

+2
-18
lines changed

4 files changed

+2
-18
lines changed
 

‎doc/source/whatsnew/v1.2.0.rst

-1
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,6 @@ Deprecations
484484
- Deprecated :meth:`Index.asi8` for :class:`Index` subclasses other than :class:`.DatetimeIndex`, :class:`.TimedeltaIndex`, and :class:`PeriodIndex` (:issue:`37877`)
485485
- The ``inplace`` parameter of :meth:`Categorical.remove_unused_categories` is deprecated and will be removed in a future version (:issue:`37643`)
486486
- The ``null_counts`` parameter of :meth:`DataFrame.info` is deprecated and replaced by ``show_counts``. It will be removed in a future version (:issue:`37999`)
487-
- Deprecated membership checks for nan-likes in :class:`Categorical`. In the future the membership check will only return True if the nan-like is ``nan`` or of the same dtype as the underlying categories (:issue:`37867`)
488487

489488
.. ---------------------------------------------------------------------------
490489

‎pandas/core/arrays/categorical.py

-7
Original file line numberDiff line numberDiff line change
@@ -1749,13 +1749,6 @@ def __contains__(self, key) -> bool:
17491749

17501750
# if key is a NaN, check if any NaN is in self.
17511751
if is_valid_nat_for_dtype(key, self.categories.dtype):
1752-
if key is not self.dtype.na_value and not isinstance(key, self.dtype.type):
1753-
warn(
1754-
f"Membership check with {key} will return False in the future. "
1755-
f"Consider using {self.dtype.na_value} instead",
1756-
FutureWarning,
1757-
stacklevel=2,
1758-
)
17591752
return self.isna().any()
17601753

17611754
return contains(self, key, container=self._codes)

‎pandas/core/arrays/numpy_.py

-7
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,6 @@ def numpy_dtype(self) -> np.dtype:
5151
"""
5252
return self._dtype
5353

54-
@property
55-
def na_value(self) -> object:
56-
if issubclass(self.type, np.floating):
57-
return self.type("nan")
58-
else:
59-
return super().na_value
60-
6154
@property
6255
def name(self) -> str:
6356
"""

‎pandas/tests/extension/test_categorical.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,8 @@ def test_contains(self, data, data_missing):
109109
if na_value_type is na_value:
110110
continue
111111

112-
with tm.assert_produces_warning(FutureWarning, check_stacklevel=False):
113-
assert na_value_type not in data
114-
assert na_value_type in data_missing
112+
assert na_value_type not in data
113+
assert na_value_type in data_missing
115114

116115

117116
class TestConstructors(base.BaseConstructorsTests):

0 commit comments

Comments
 (0)
Please sign in to comment.