File tree 2 files changed +4
-3
lines changed
2 files changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -279,8 +279,7 @@ def _get_ilevel_values(index, level):
279
279
right = safe_sort_index (right )
280
280
281
281
# MultiIndex special comparison for little-friendly error messages
282
- if left .nlevels > 1 :
283
- left = cast (MultiIndex , left )
282
+ if isinstance (left , MultiIndex ):
284
283
right = cast (MultiIndex , right )
285
284
286
285
for level in range (left .nlevels ):
@@ -303,7 +302,7 @@ def _get_ilevel_values(index, level):
303
302
_check_types (left .levels [level ], right .levels [level ], obj = obj )
304
303
305
304
# skip exact index checking when `check_categorical` is False
306
- if check_exact and check_categorical :
305
+ elif check_exact and check_categorical :
307
306
if not left .equals (right ):
308
307
mismatch = left ._values != right ._values
309
308
Original file line number Diff line number Diff line change @@ -558,6 +558,8 @@ def test_union_with_missing_values_on_both_sides(nulls_fixture):
558
558
mi2 = MultiIndex .from_arrays ([[1 , nulls_fixture , 3 ]])
559
559
result = mi1 .union (mi2 )
560
560
expected = MultiIndex .from_arrays ([[1 , 3 , nulls_fixture ]])
561
+ # We don't particularly care about having levels[0] be float64, but it is
562
+ expected = expected .set_levels ([expected .levels [0 ].astype (np .float64 )])
561
563
tm .assert_index_equal (result , expected )
562
564
563
565
You can’t perform that action at this time.
0 commit comments