#NEWLINE# def test_join_multi( self ) : #NEWLINE# #INDENT# midx = pd . MultiIndex . from_product ( [ np . arange ( 4 ) , np . arange ( 4 ) ] , names = [ 'a' , 'b' ] ) #NEWLINE# idx = pd . Index ( [ 1 , 2 , 5 ] , name = 'b' ) #NEWLINE# ( jidx , lidx , ridx ) = midx . join ( idx , how = 'inner' , return_indexers = True ) #NEWLINE# exp_idx = pd . MultiIndex . from_product ( [ np . arange ( 4 ) , [ 1 , 2 ] ] , names = [ 'a' , 'b' ] ) #NEWLINE# exp_lidx = np . array ( [ 1 , 2 , 5 , 6 , 9 , 10 , 13 , 14 ] ) #NEWLINE# exp_ridx = np . array ( [ 0 , 1 , 0 , 1 , 0 , 1 , 0 , 1 ] ) #NEWLINE# self . assert_index_equal ( jidx , exp_idx ) #NEWLINE# self . assert_numpy_array_equal ( lidx , exp_lidx ) #NEWLINE# self . assert_numpy_array_equal ( ridx , exp_ridx ) #NEWLINE# ( jidx , ridx , lidx ) = idx . join ( midx , how = 'inner' , return_indexers = True ) #NEWLINE# self . assert_index_equal ( jidx , exp_idx ) #NEWLINE# self . assert_numpy_array_equal ( lidx , exp_lidx ) #NEWLINE# self . assert_numpy_array_equal ( ridx , exp_ridx ) #NEWLINE# ( jidx , lidx , ridx ) = midx . join ( idx , how = 'left' , return_indexers = True ) #NEWLINE# exp_ridx = np . array ( [ ( - 1 ) , 0 , 1 , ( - 1 ) , ( - 1 ) , 0 , 1 , ( - 1 ) , ( - 1 ) , 0 , 1 , ( - 1 ) , ( - 1 ) , 0 , 1 , ( - 1 ) ] ) #NEWLINE# self . assert_index_equal ( jidx , midx ) #NEWLINE# self . assertIsNone ( lidx ) #NEWLINE# self . assert_numpy_array_equal ( ridx , exp_ridx ) #NEWLINE# ( jidx , ridx , lidx ) = idx . join ( midx , how = 'right' , return_indexers = True ) #NEWLINE# self . assert_index_equal ( jidx , midx ) #NEWLINE# self . assertIsNone ( lidx ) #NEWLINE# self . assert_numpy_array_equal ( ridx , exp_ridx )