29
29
from pandas ._typing import (
30
30
AnyArrayLike ,
31
31
ArrayLike ,
32
- AxisInt ,
33
32
DtypeObj ,
34
33
IndexLabel ,
35
34
JoinHow ,
@@ -647,8 +646,6 @@ class _MergeOperation:
647
646
right_on : Sequence [Hashable | AnyArrayLike ]
648
647
left_index : bool
649
648
right_index : bool
650
- axis : AxisInt
651
- bm_axis : AxisInt
652
649
sort : bool
653
650
suffixes : Suffixes
654
651
copy : bool
@@ -666,7 +663,6 @@ def __init__(
666
663
on : IndexLabel | None = None ,
667
664
left_on : IndexLabel | None = None ,
668
665
right_on : IndexLabel | None = None ,
669
- axis : AxisInt = 1 ,
670
666
left_index : bool = False ,
671
667
right_index : bool = False ,
672
668
sort : bool = True ,
@@ -680,11 +676,6 @@ def __init__(
680
676
self .right = self .orig_right = _right
681
677
self .how = how
682
678
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
-
688
679
self .on = com .maybe_make_list (on )
689
680
690
681
self .suffixes = suffixes
@@ -1045,8 +1036,8 @@ def _get_join_info(
1045
1036
) -> tuple [Index , npt .NDArray [np .intp ] | None , npt .NDArray [np .intp ] | None ]:
1046
1037
# make mypy happy
1047
1038
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
1050
1041
1051
1042
if self .left_index and self .right_index and self .how != "asof" :
1052
1043
join_index , left_indexer , right_indexer = left_ax .join (
@@ -1068,32 +1059,32 @@ def _get_join_info(
1068
1059
if self .right_index :
1069
1060
if len (self .left ) > 0 :
1070
1061
join_index = self ._create_join_index (
1071
- self . left . index ,
1072
- self . right . index ,
1062
+ left_ax ,
1063
+ right_ax ,
1073
1064
left_indexer ,
1074
1065
how = "right" ,
1075
1066
)
1076
1067
else :
1077
- join_index = self . right . index .take (right_indexer )
1068
+ join_index = right_ax .take (right_indexer )
1078
1069
elif self .left_index :
1079
1070
if self .how == "asof" :
1080
1071
# GH#33463 asof should always behave like a left merge
1081
1072
join_index = self ._create_join_index (
1082
- self . left . index ,
1083
- self . right . index ,
1073
+ left_ax ,
1074
+ right_ax ,
1084
1075
left_indexer ,
1085
1076
how = "left" ,
1086
1077
)
1087
1078
1088
1079
elif len (self .right ) > 0 :
1089
1080
join_index = self ._create_join_index (
1090
- self . right . index ,
1091
- self . left . index ,
1081
+ right_ax ,
1082
+ left_ax ,
1092
1083
right_indexer ,
1093
1084
how = "left" ,
1094
1085
)
1095
1086
else :
1096
- join_index = self . left . index .take (left_indexer )
1087
+ join_index = left_ax .take (left_indexer )
1097
1088
else :
1098
1089
join_index = default_index (len (left_indexer ))
1099
1090
@@ -1798,7 +1789,6 @@ def __init__(
1798
1789
right_on : IndexLabel | None = None ,
1799
1790
left_index : bool = False ,
1800
1791
right_index : bool = False ,
1801
- axis : AxisInt = 1 ,
1802
1792
suffixes : Suffixes = ("_x" , "_y" ),
1803
1793
fill_method : str | None = None ,
1804
1794
how : JoinHow | Literal ["asof" ] = "outer" ,
@@ -1813,7 +1803,6 @@ def __init__(
1813
1803
left_index = left_index ,
1814
1804
right_index = right_index ,
1815
1805
right_on = right_on ,
1816
- axis = axis ,
1817
1806
how = how ,
1818
1807
suffixes = suffixes ,
1819
1808
sort = True , # factorize sorts
@@ -1886,10 +1875,7 @@ def __init__(
1886
1875
by = None ,
1887
1876
left_by = None ,
1888
1877
right_by = None ,
1889
- axis : AxisInt = 1 ,
1890
1878
suffixes : Suffixes = ("_x" , "_y" ),
1891
- copy : bool = True ,
1892
- fill_method : str | None = None ,
1893
1879
how : Literal ["asof" ] = "asof" ,
1894
1880
tolerance = None ,
1895
1881
allow_exact_matches : bool = True ,
@@ -1911,10 +1897,9 @@ def __init__(
1911
1897
right_on = right_on ,
1912
1898
left_index = left_index ,
1913
1899
right_index = right_index ,
1914
- axis = axis ,
1915
1900
how = how ,
1916
1901
suffixes = suffixes ,
1917
- fill_method = fill_method ,
1902
+ fill_method = None ,
1918
1903
)
1919
1904
1920
1905
def _validate_left_right_on (self , left_on , right_on ):
0 commit comments