#NEWLINE# def test_merge_join_different_levels( self ) : #NEWLINE# #INDENT# df1 = DataFrame ( columns = [ 'a' , 'b' ] , data = [ [ 1 , 11 ] , [ 0 , 22 ] ] ) #NEWLINE# columns = MultiIndex . from_tuples ( [ ( 'a' , '' ) , ( 'c' , 'c1' ) ] ) #NEWLINE# df2 = DataFrame ( columns = columns , data = [ [ 1 , 33 ] , [ 0 , 44 ] ] ) #NEWLINE# columns = [ 'a' , 'b' , ( 'c' , 'c1' ) ] #NEWLINE# expected = DataFrame ( columns = columns , data = [ [ 1 , 11 , 33 ] , [ 0 , 22 , 44 ] ] ) #NEWLINE# with tm . assert_produces_warning ( UserWarning ) : #NEWLINE# #INDENT# result = pd . merge ( df1 , df2 , on = 'a' ) #NEWLINE# #UNINDENT# tm . assert_frame_equal ( columns , expected ) #NEWLINE# columns = [ 'a' , 'b' , ( 'a' , '' ) , ( 'c' , 'c1' ) ] #NEWLINE# expected = DataFrame ( columns = columns , data = [ [ 1 , 11 , 0 , 44 ] , [ 0 , 22 , 1 , 33 ] ] ) #NEWLINE# with tm . assert_produces_warning ( UserWarning ) : #NEWLINE# #INDENT# result = df1 . join ( df2 , on = 'a' ) #NEWLINE# #UNINDENT# tm . assert_frame_equal ( result , expected )