Skip to content

Commit a8eaebf

Browse files
jbrockmendelWillAyd
authored andcommitted
CLN: simplify Float64Index.__contains__ (#30899)
1 parent 721a2eb commit a8eaebf

File tree

1 file changed

+1
-14
lines changed

1 file changed

+1
-14
lines changed

pandas/core/indexes/numeric.py

+1-14
Original file line numberDiff line numberDiff line change
@@ -477,20 +477,7 @@ def __contains__(self, other) -> bool:
477477
if super().__contains__(other):
478478
return True
479479

480-
try:
481-
# if other is a sequence this throws a ValueError
482-
return np.isnan(other) and self.hasnans
483-
except ValueError:
484-
try:
485-
return len(other) <= 1 and other.item() in self
486-
except AttributeError:
487-
return len(other) <= 1 and other in self
488-
except TypeError:
489-
pass
490-
except TypeError:
491-
pass
492-
493-
return False
480+
return is_float(other) and np.isnan(other) and self.hasnans
494481

495482
@Appender(_index_shared_docs["get_loc"])
496483
def get_loc(self, key, method=None, tolerance=None):

0 commit comments

Comments
 (0)