@@ -3983,7 +3983,8 @@ def _join_multi(self, other, how, return_indexers=True):
3983
3983
3984
3984
def _join_non_unique (self , other , how = 'left' , return_indexers = False ):
3985
3985
from pandas .core .reshape .merge import _get_join_indexers
3986
-
3986
+ tolerance = self ._choose_tolerance ([other ])
3987
+ # FIXME: intolerant
3987
3988
left_idx , right_idx = _get_join_indexers ([self ._ndarray_values ],
3988
3989
[other ._ndarray_values ],
3989
3990
how = how ,
@@ -3996,7 +3997,7 @@ def _join_non_unique(self, other, how='left', return_indexers=False):
3996
3997
mask = left_idx == - 1
3997
3998
np .putmask (join_index , mask , other ._ndarray_values .take (right_idx ))
3998
3999
3999
- join_index = self ._wrap_joined_index (join_index , other )
4000
+ join_index = self ._wrap_joined_index (join_index , other , tolerance )
4000
4001
4001
4002
if return_indexers :
4002
4003
return join_index , left_idx , right_idx
@@ -4133,9 +4134,12 @@ def _get_leaf_sorter(labels):
4133
4134
else :
4134
4135
return join_index
4135
4136
4136
- def _join_monotonic (self , other , how = 'left' , return_indexers = False ):
4137
- if self .equals (other ):
4137
+ def _join_monotonic (self , other , how = 'left' , return_indexers = False ,
4138
+ tolerance = None ):
4139
+ tolerance = self ._choose_tolerance ([other ], tolerance = tolerance )
4140
+ if self .equals (other , tolerance = tolerance ):
4138
4141
ret_index = other if how == 'right' else self
4142
+ # FIXME: intolerant, need to set the used tolerance
4139
4143
if return_indexers :
4140
4144
return ret_index , None , None
4141
4145
else :
@@ -4145,6 +4149,7 @@ def _join_monotonic(self, other, how='left', return_indexers=False):
4145
4149
ov = other ._ndarray_values
4146
4150
4147
4151
if self .is_unique and other .is_unique :
4152
+ # FIXME: intolerant
4148
4153
# We can perform much better than the general case
4149
4154
if how == 'left' :
4150
4155
join_index = self
@@ -4156,11 +4161,14 @@ def _join_monotonic(self, other, how='left', return_indexers=False):
4156
4161
ridx = None
4157
4162
elif how == 'inner' :
4158
4163
join_index , lidx , ridx = self ._inner_indexer (sv , ov )
4159
- join_index = self ._wrap_joined_index (join_index , other )
4164
+ join_index = self ._wrap_joined_index (join_index , other ,
4165
+ tolerance )
4160
4166
elif how == 'outer' :
4161
4167
join_index , lidx , ridx = self ._outer_indexer (sv , ov )
4162
- join_index = self ._wrap_joined_index (join_index , other )
4168
+ join_index = self ._wrap_joined_index (join_index , other ,
4169
+ tolerance )
4163
4170
else :
4171
+ # FIXME: intolerant
4164
4172
if how == 'left' :
4165
4173
join_index , lidx , ridx = self ._left_indexer (sv , ov )
4166
4174
elif how == 'right' :
@@ -4169,7 +4177,7 @@ def _join_monotonic(self, other, how='left', return_indexers=False):
4169
4177
join_index , lidx , ridx = self ._inner_indexer (sv , ov )
4170
4178
elif how == 'outer' :
4171
4179
join_index , lidx , ridx = self ._outer_indexer (sv , ov )
4172
- join_index = self ._wrap_joined_index (join_index , other )
4180
+ join_index = self ._wrap_joined_index (join_index , other , tolerance )
4173
4181
4174
4182
if return_indexers :
4175
4183
lidx = None if lidx is None else ensure_platform_int (lidx )
@@ -4178,9 +4186,9 @@ def _join_monotonic(self, other, how='left', return_indexers=False):
4178
4186
else :
4179
4187
return join_index
4180
4188
4181
- def _wrap_joined_index (self , joined , other ):
4189
+ def _wrap_joined_index (self , joined , other , tolerance ):
4182
4190
name = self .name if self .name == other .name else None
4183
- return Index (joined , name = name )
4191
+ return Index (joined , name = name , tolerance = tolerance )
4184
4192
4185
4193
def _get_string_slice (self , key , use_lhs = True , use_rhs = True ):
4186
4194
# this is for partial string indexing,
0 commit comments