File tree 2 files changed +8
-13
lines changed
2 files changed +8
-13
lines changed Original file line number Diff line number Diff line change @@ -418,19 +418,12 @@ cdef class DatetimeEngine(Int64Engine):
418
418
def __contains__ (self , val: object ) -> bool:
419
419
# We assume before we get here:
420
420
# - val is hashable
421
- cdef:
422
- int64_t loc , conv
423
-
424
- conv = self ._unbox_scalar(val)
425
- if self.over_size_threshold and self.is_monotonic_increasing:
426
- if not self.is_unique:
427
- return self._get_loc_duplicates(conv )
428
- values = self .values
429
- loc = values.searchsorted(conv, side = ' left' )
430
- return values[loc] == conv
431
-
432
- self._ensure_mapping_populated()
433
- return conv in self.mapping
421
+ self._unbox_scalar(val )
422
+ try:
423
+ self.get_loc(val )
424
+ return True
425
+ except KeyError:
426
+ return False
434
427
435
428
cdef _call_monotonic(self , values ):
436
429
return algos.is_monotonic(values, timelike = True )
Original file line number Diff line number Diff line change @@ -3953,6 +3953,8 @@ def __delitem__(self, key) -> None:
3953
3953
maybe_shortcut = False
3954
3954
if self .ndim == 2 and isinstance (self .columns , MultiIndex ):
3955
3955
try :
3956
+ # By using engine's __contains__ we effectively
3957
+ # restrict to same-length tuples
3956
3958
maybe_shortcut = key not in self .columns ._engine
3957
3959
except TypeError :
3958
3960
pass
You can’t perform that action at this time.
0 commit comments