Skip to content

REF: remove unused merge args #53789

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 11 additions & 26 deletions pandas/core/reshape/merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
from pandas._typing import (
AnyArrayLike,
ArrayLike,
AxisInt,
DtypeObj,
IndexLabel,
JoinHow,
Expand Down Expand Up @@ -647,8 +646,6 @@ class _MergeOperation:
right_on: Sequence[Hashable | AnyArrayLike]
left_index: bool
right_index: bool
axis: AxisInt
bm_axis: AxisInt
sort: bool
suffixes: Suffixes
copy: bool
Expand All @@ -666,7 +663,6 @@ def __init__(
on: IndexLabel | None = None,
left_on: IndexLabel | None = None,
right_on: IndexLabel | None = None,
axis: AxisInt = 1,
left_index: bool = False,
right_index: bool = False,
sort: bool = True,
Expand All @@ -680,11 +676,6 @@ def __init__(
self.right = self.orig_right = _right
self.how = how

# bm_axis -> the axis on the BlockManager
self.bm_axis = axis
# axis --> the axis on the Series/DataFrame
self.axis = 1 - axis if self.left.ndim == 2 else 0

self.on = com.maybe_make_list(on)

self.suffixes = suffixes
Expand Down Expand Up @@ -1037,8 +1028,8 @@ def _get_join_info(
) -> tuple[Index, npt.NDArray[np.intp] | None, npt.NDArray[np.intp] | None]:
# make mypy happy
assert self.how != "cross"
left_ax = self.left.axes[self.axis]
right_ax = self.right.axes[self.axis]
left_ax = self.left.index
right_ax = self.right.index

if self.left_index and self.right_index and self.how != "asof":
join_index, left_indexer, right_indexer = left_ax.join(
Expand All @@ -1060,32 +1051,32 @@ def _get_join_info(
if self.right_index:
if len(self.left) > 0:
join_index = self._create_join_index(
self.left.index,
self.right.index,
left_ax,
right_ax,
left_indexer,
how="right",
)
else:
join_index = self.right.index.take(right_indexer)
join_index = right_ax.take(right_indexer)
elif self.left_index:
if self.how == "asof":
# GH#33463 asof should always behave like a left merge
join_index = self._create_join_index(
self.left.index,
self.right.index,
left_ax,
right_ax,
left_indexer,
how="left",
)

elif len(self.right) > 0:
join_index = self._create_join_index(
self.right.index,
self.left.index,
right_ax,
left_ax,
right_indexer,
how="left",
)
else:
join_index = self.left.index.take(left_indexer)
join_index = left_ax.take(left_indexer)
else:
join_index = default_index(len(left_indexer))

Expand Down Expand Up @@ -1784,7 +1775,6 @@ def __init__(
right_on: IndexLabel | None = None,
left_index: bool = False,
right_index: bool = False,
axis: AxisInt = 1,
suffixes: Suffixes = ("_x", "_y"),
fill_method: str | None = None,
how: JoinHow | Literal["asof"] = "outer",
Expand All @@ -1799,7 +1789,6 @@ def __init__(
left_index=left_index,
right_index=right_index,
right_on=right_on,
axis=axis,
how=how,
suffixes=suffixes,
sort=True, # factorize sorts
Expand Down Expand Up @@ -1872,10 +1861,7 @@ def __init__(
by=None,
left_by=None,
right_by=None,
axis: AxisInt = 1,
suffixes: Suffixes = ("_x", "_y"),
copy: bool = True,
fill_method: str | None = None,
how: Literal["asof"] = "asof",
tolerance=None,
allow_exact_matches: bool = True,
Expand All @@ -1897,10 +1883,9 @@ def __init__(
right_on=right_on,
left_index=left_index,
right_index=right_index,
axis=axis,
how=how,
suffixes=suffixes,
fill_method=fill_method,
fill_method=None,
)

def _validate_left_right_on(self, left_on, right_on):
Expand Down