Skip to content

Commit 6928327

Browse files
jbrockmendelWillAyd
authored andcommitted
CLN: misc cleanups (#30877)
1 parent 993fdbe commit 6928327

File tree

2 files changed

+4
-12
lines changed

2 files changed

+4
-12
lines changed

pandas/_libs/index.pyx

-2
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ cdef class IndexEngine:
8585
"""
8686
cdef:
8787
object loc
88-
void* data_ptr
8988

9089
loc = self.get_loc(key)
9190
if isinstance(loc, slice) or util.is_array(loc):
@@ -101,7 +100,6 @@ cdef class IndexEngine:
101100
"""
102101
cdef:
103102
object loc
104-
void* data_ptr
105103

106104
loc = self.get_loc(key)
107105
value = convert_scalar(arr, value)

pandas/core/indexes/datetimelike.py

+4-10
Original file line numberDiff line numberDiff line change
@@ -156,13 +156,11 @@ def equals(self, other) -> bool:
156156
def __contains__(self, key):
157157
try:
158158
res = self.get_loc(key)
159-
return (
160-
is_scalar(res)
161-
or isinstance(res, slice)
162-
or (is_list_like(res) and len(res))
163-
)
164159
except (KeyError, TypeError, ValueError):
165160
return False
161+
return bool(
162+
is_scalar(res) or isinstance(res, slice) or (is_list_like(res) and len(res))
163+
)
166164

167165
# Try to run function on index first, and then on elements of index
168166
# Especially important for group-by functionality
@@ -875,11 +873,7 @@ def _is_convertible_to_index_for_join(cls, other: Index) -> bool:
875873

876874
def _wrap_joined_index(self, joined, other):
877875
name = get_op_result_name(self, other)
878-
if (
879-
isinstance(other, type(self))
880-
and self.freq == other.freq
881-
and self._can_fast_union(other)
882-
):
876+
if self._can_fast_union(other):
883877
joined = self._shallow_copy(joined)
884878
joined.name = name
885879
return joined

0 commit comments

Comments
 (0)