From ca9d876f925126d30d76d20424b2589a80d65a30 Mon Sep 17 00:00:00 2001 From: Brock Date: Wed, 21 Jun 2023 21:51:25 -0700 Subject: [PATCH] REF: remove unused merge args --- pandas/core/reshape/merge.py | 37 +++++++++++------------------------- 1 file changed, 11 insertions(+), 26 deletions(-) diff --git a/pandas/core/reshape/merge.py b/pandas/core/reshape/merge.py index cbcdc3813c24d..9d43a665a5649 100644 --- a/pandas/core/reshape/merge.py +++ b/pandas/core/reshape/merge.py @@ -29,7 +29,6 @@ from pandas._typing import ( AnyArrayLike, ArrayLike, - AxisInt, DtypeObj, IndexLabel, JoinHow, @@ -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 @@ -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, @@ -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 @@ -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( @@ -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)) @@ -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", @@ -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 @@ -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, @@ -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):