@@ -199,7 +199,7 @@ def identical(self, other):
199199 For Index
200200
201201 >>> idx.identical(idx)
202- False
202+ True
203203 >>> with option_context('compute.ops_on_diff_frames', True):
204204 ... idx.identical(ks.Index(['a', 'b', 'c']))
205205 True
@@ -212,7 +212,7 @@ def identical(self, other):
212212 For MultiIndex
213213
214214 >>> midx.identical(midx)
215- False
215+ True
216216 >>> with option_context('compute.ops_on_diff_frames', True):
217217 ... midx.identical(ks.MultiIndex.from_tuples([('a', 'x'), ('b', 'y'), ('c', 'z')]))
218218 True
@@ -225,7 +225,7 @@ def identical(self, other):
225225 self_name = self .names if isinstance (self , MultiIndex ) else self .name
226226 other_name = other .names if isinstance (other , MultiIndex ) else other .name
227227
228- return (
228+ return (self is other ) or (
229229 type (self ) == type (other ) and # to support non-index comparison by short-circuiting.
230230 self_name == other_name and
231231 self .equals (other ))
@@ -252,7 +252,7 @@ def equals(self, other):
252252 For Index
253253
254254 >>> idx.equals(idx)
255- False
255+ True
256256 >>> with option_context('compute.ops_on_diff_frames', True):
257257 ... idx.equals(ks.Index(['a', 'b', 'c']))
258258 True
@@ -265,7 +265,7 @@ def equals(self, other):
265265 For MultiIndex
266266
267267 >>> midx.equals(midx)
268- False
268+ True
269269 >>> with option_context('compute.ops_on_diff_frames', True):
270270 ... midx.equals(ks.MultiIndex.from_tuples([('a', 'x'), ('b', 'y'), ('c', 'z')]))
271271 True
@@ -280,9 +280,10 @@ def equals(self, other):
280280 # Directly using Series from both self and other seems causing
281281 # some exceptions when 'compute.ops_on_diff_frames' is enabled.
282282 # Working around for now via using frame.
283- return self is not other and type (self ) == type (other ) and (
284- self .to_series ().rename ("self" ).to_frame ().reset_index ()['self' ] ==
285- other .to_series ().rename ("other" ).to_frame ().reset_index ()['other' ]).all ()
283+ return (self is other ) or (
284+ type (self ) == type (other ) and
285+ (self .to_series ().rename ("self" ).to_frame ().reset_index ()['self' ] ==
286+ other .to_series ().rename ("other" ).to_frame ().reset_index ()['other' ]).all ())
286287
287288 def transpose (self ):
288289 """
0 commit comments