From b21fdae35afcc4140166b43ecb892efb0bb38225 Mon Sep 17 00:00:00 2001 From: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com> Date: Thu, 18 Jul 2024 14:18:34 -0700 Subject: [PATCH] Exclude datelike types --- python/cudf/cudf/core/index.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/python/cudf/cudf/core/index.py b/python/cudf/cudf/core/index.py index 4218945e5f5..cd52a34e35e 100644 --- a/python/cudf/cudf/core/index.py +++ b/python/cudf/cudf/core/index.py @@ -355,12 +355,10 @@ def _data(self): @_performance_tracking def __contains__(self, item): hash(item) - if isinstance(item, bool) or not isinstance( - item, (np.floating, np.integer, int, float) - ): + if not isinstance(item, (np.floating, np.integer, int, float)): return False - elif isinstance(item, (np.timedelta64, np.datetime64)): - # Are instances of np.integer + elif isinstance(item, (np.timedelta64, np.datetime64, bool)): + # Cases that would pass the above check return False try: int_item = int(item)