Skip to content

Commit ce020b1

Browse files
authored
REF: remove unused merge args (#53789)
1 parent e484ecb commit ce020b1

File tree

1 file changed

+11
-26
lines changed

1 file changed

+11
-26
lines changed

pandas/core/reshape/merge.py

+11-26
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
from pandas._typing import (
3030
AnyArrayLike,
3131
ArrayLike,
32-
AxisInt,
3332
DtypeObj,
3433
IndexLabel,
3534
JoinHow,
@@ -647,8 +646,6 @@ class _MergeOperation:
647646
right_on: Sequence[Hashable | AnyArrayLike]
648647
left_index: bool
649648
right_index: bool
650-
axis: AxisInt
651-
bm_axis: AxisInt
652649
sort: bool
653650
suffixes: Suffixes
654651
copy: bool
@@ -666,7 +663,6 @@ def __init__(
666663
on: IndexLabel | None = None,
667664
left_on: IndexLabel | None = None,
668665
right_on: IndexLabel | None = None,
669-
axis: AxisInt = 1,
670666
left_index: bool = False,
671667
right_index: bool = False,
672668
sort: bool = True,
@@ -680,11 +676,6 @@ def __init__(
680676
self.right = self.orig_right = _right
681677
self.how = how
682678

683-
# bm_axis -> the axis on the BlockManager
684-
self.bm_axis = axis
685-
# axis --> the axis on the Series/DataFrame
686-
self.axis = 1 - axis if self.left.ndim == 2 else 0
687-
688679
self.on = com.maybe_make_list(on)
689680

690681
self.suffixes = suffixes
@@ -1045,8 +1036,8 @@ def _get_join_info(
10451036
) -> tuple[Index, npt.NDArray[np.intp] | None, npt.NDArray[np.intp] | None]:
10461037
# make mypy happy
10471038
assert self.how != "cross"
1048-
left_ax = self.left.axes[self.axis]
1049-
right_ax = self.right.axes[self.axis]
1039+
left_ax = self.left.index
1040+
right_ax = self.right.index
10501041

10511042
if self.left_index and self.right_index and self.how != "asof":
10521043
join_index, left_indexer, right_indexer = left_ax.join(
@@ -1068,32 +1059,32 @@ def _get_join_info(
10681059
if self.right_index:
10691060
if len(self.left) > 0:
10701061
join_index = self._create_join_index(
1071-
self.left.index,
1072-
self.right.index,
1062+
left_ax,
1063+
right_ax,
10731064
left_indexer,
10741065
how="right",
10751066
)
10761067
else:
1077-
join_index = self.right.index.take(right_indexer)
1068+
join_index = right_ax.take(right_indexer)
10781069
elif self.left_index:
10791070
if self.how == "asof":
10801071
# GH#33463 asof should always behave like a left merge
10811072
join_index = self._create_join_index(
1082-
self.left.index,
1083-
self.right.index,
1073+
left_ax,
1074+
right_ax,
10841075
left_indexer,
10851076
how="left",
10861077
)
10871078

10881079
elif len(self.right) > 0:
10891080
join_index = self._create_join_index(
1090-
self.right.index,
1091-
self.left.index,
1081+
right_ax,
1082+
left_ax,
10921083
right_indexer,
10931084
how="left",
10941085
)
10951086
else:
1096-
join_index = self.left.index.take(left_indexer)
1087+
join_index = left_ax.take(left_indexer)
10971088
else:
10981089
join_index = default_index(len(left_indexer))
10991090

@@ -1798,7 +1789,6 @@ def __init__(
17981789
right_on: IndexLabel | None = None,
17991790
left_index: bool = False,
18001791
right_index: bool = False,
1801-
axis: AxisInt = 1,
18021792
suffixes: Suffixes = ("_x", "_y"),
18031793
fill_method: str | None = None,
18041794
how: JoinHow | Literal["asof"] = "outer",
@@ -1813,7 +1803,6 @@ def __init__(
18131803
left_index=left_index,
18141804
right_index=right_index,
18151805
right_on=right_on,
1816-
axis=axis,
18171806
how=how,
18181807
suffixes=suffixes,
18191808
sort=True, # factorize sorts
@@ -1886,10 +1875,7 @@ def __init__(
18861875
by=None,
18871876
left_by=None,
18881877
right_by=None,
1889-
axis: AxisInt = 1,
18901878
suffixes: Suffixes = ("_x", "_y"),
1891-
copy: bool = True,
1892-
fill_method: str | None = None,
18931879
how: Literal["asof"] = "asof",
18941880
tolerance=None,
18951881
allow_exact_matches: bool = True,
@@ -1911,10 +1897,9 @@ def __init__(
19111897
right_on=right_on,
19121898
left_index=left_index,
19131899
right_index=right_index,
1914-
axis=axis,
19151900
how=how,
19161901
suffixes=suffixes,
1917-
fill_method=fill_method,
1902+
fill_method=None,
19181903
)
19191904

19201905
def _validate_left_right_on(self, left_on, right_on):

0 commit comments

Comments
 (0)