Skip to content

Commit c869255

Browse files
topper-123jbrockmendel
authored andcommitted
CLN: move code out of try clause in merge.py (#30382)
1 parent 8376067 commit c869255

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

pandas/core/reshape/merge.py

+13-13
Original file line numberDiff line numberDiff line change
@@ -116,20 +116,20 @@ def _groupby_and_merge(
116116

117117
# if we can groupby the rhs
118118
# then we can get vastly better perf
119-
try:
120119

121-
# we will check & remove duplicates if indicated
122-
if check_duplicates:
123-
if on is None:
124-
on = []
125-
elif not isinstance(on, (list, tuple)):
126-
on = [on]
127-
128-
if right.duplicated(by + on).any():
129-
_right = right.drop_duplicates(by + on, keep="last")
130-
# TODO: use overload to refine return type of drop_duplicates
131-
assert _right is not None # needed for mypy
132-
right = _right
120+
# we will check & remove duplicates if indicated
121+
if check_duplicates:
122+
if on is None:
123+
on = []
124+
elif not isinstance(on, (list, tuple)):
125+
on = [on]
126+
127+
if right.duplicated(by + on).any():
128+
_right = right.drop_duplicates(by + on, keep="last")
129+
# TODO: use overload to refine return type of drop_duplicates
130+
assert _right is not None # needed for mypy
131+
right = _right
132+
try:
133133
rby = right.groupby(by, sort=False)
134134
except KeyError:
135135
rby = None

0 commit comments

Comments
 (0)