11import numpy as np
22import pytest
33
4- import pandas as pd
54from pandas import Index , MultiIndex
65import pandas ._testing as tm
76
@@ -51,12 +50,12 @@ def test_join_self(idx, join_type):
5150
5251def test_join_multi ():
5352 # GH 10665
54- midx = pd . MultiIndex .from_product ([np .arange (4 ), np .arange (4 )], names = ["a" , "b" ])
53+ midx = MultiIndex .from_product ([np .arange (4 ), np .arange (4 )], names = ["a" , "b" ])
5554 idx = Index ([1 , 2 , 5 ], name = "b" )
5655
5756 # inner
5857 jidx , lidx , ridx = midx .join (idx , how = "inner" , return_indexers = True )
59- exp_idx = pd . MultiIndex .from_product ([np .arange (4 ), [1 , 2 ]], names = ["a" , "b" ])
58+ exp_idx = MultiIndex .from_product ([np .arange (4 ), [1 , 2 ]], names = ["a" , "b" ])
6059 exp_lidx = np .array ([1 , 2 , 5 , 6 , 9 , 10 , 13 , 14 ], dtype = np .intp )
6160 exp_ridx = np .array ([0 , 1 , 0 , 1 , 0 , 1 , 0 , 1 ], dtype = np .intp )
6261 tm .assert_index_equal (jidx , exp_idx )
@@ -93,8 +92,8 @@ def test_join_multi_wrong_order():
9392 # GH 25760
9493 # GH 28956
9594
96- midx1 = pd . MultiIndex .from_product ([[1 , 2 ], [3 , 4 ]], names = ["a" , "b" ])
97- midx2 = pd . MultiIndex .from_product ([[1 , 2 ], [3 , 4 ]], names = ["b" , "a" ])
95+ midx1 = MultiIndex .from_product ([[1 , 2 ], [3 , 4 ]], names = ["a" , "b" ])
96+ midx2 = MultiIndex .from_product ([[1 , 2 ], [3 , 4 ]], names = ["b" , "a" ])
9897
9998 join_idx , lidx , ridx = midx1 .join (midx2 , return_indexers = True )
10099
@@ -108,8 +107,8 @@ def test_join_multi_wrong_order():
108107def test_join_multi_return_indexers ():
109108 # GH 34074
110109
111- midx1 = pd . MultiIndex .from_product ([[1 , 2 ], [3 , 4 ], [5 , 6 ]], names = ["a" , "b" , "c" ])
112- midx2 = pd . MultiIndex .from_product ([[1 , 2 ], [3 , 4 ]], names = ["a" , "b" ])
110+ midx1 = MultiIndex .from_product ([[1 , 2 ], [3 , 4 ], [5 , 6 ]], names = ["a" , "b" , "c" ])
111+ midx2 = MultiIndex .from_product ([[1 , 2 ], [3 , 4 ]], names = ["a" , "b" ])
113112
114113 result = midx1 .join (midx2 , return_indexers = False )
115114 tm .assert_index_equal (result , midx1 )
0 commit comments