11import numpy as np
22import pytest
33
4- import pandas as pd
54from pandas import (
65 Index ,
76 MultiIndex ,
@@ -54,12 +53,12 @@ def test_join_self(idx, join_type):
5453
5554def test_join_multi ():
5655 # GH 10665
57- midx = pd . MultiIndex .from_product ([np .arange (4 ), np .arange (4 )], names = ["a" , "b" ])
56+ midx = MultiIndex .from_product ([np .arange (4 ), np .arange (4 )], names = ["a" , "b" ])
5857 idx = Index ([1 , 2 , 5 ], name = "b" )
5958
6059 # inner
6160 jidx , lidx , ridx = midx .join (idx , how = "inner" , return_indexers = True )
62- exp_idx = pd . MultiIndex .from_product ([np .arange (4 ), [1 , 2 ]], names = ["a" , "b" ])
61+ exp_idx = MultiIndex .from_product ([np .arange (4 ), [1 , 2 ]], names = ["a" , "b" ])
6362 exp_lidx = np .array ([1 , 2 , 5 , 6 , 9 , 10 , 13 , 14 ], dtype = np .intp )
6463 exp_ridx = np .array ([0 , 1 , 0 , 1 , 0 , 1 , 0 , 1 ], dtype = np .intp )
6564 tm .assert_index_equal (jidx , exp_idx )
@@ -96,8 +95,8 @@ def test_join_multi_wrong_order():
9695 # GH 25760
9796 # GH 28956
9897
99- midx1 = pd . MultiIndex .from_product ([[1 , 2 ], [3 , 4 ]], names = ["a" , "b" ])
100- midx2 = pd . MultiIndex .from_product ([[1 , 2 ], [3 , 4 ]], names = ["b" , "a" ])
98+ midx1 = MultiIndex .from_product ([[1 , 2 ], [3 , 4 ]], names = ["a" , "b" ])
99+ midx2 = MultiIndex .from_product ([[1 , 2 ], [3 , 4 ]], names = ["b" , "a" ])
101100
102101 join_idx , lidx , ridx = midx1 .join (midx2 , return_indexers = True )
103102
@@ -111,8 +110,8 @@ def test_join_multi_wrong_order():
111110def test_join_multi_return_indexers ():
112111 # GH 34074
113112
114- midx1 = pd . MultiIndex .from_product ([[1 , 2 ], [3 , 4 ], [5 , 6 ]], names = ["a" , "b" , "c" ])
115- midx2 = pd . MultiIndex .from_product ([[1 , 2 ], [3 , 4 ]], names = ["a" , "b" ])
113+ midx1 = MultiIndex .from_product ([[1 , 2 ], [3 , 4 ], [5 , 6 ]], names = ["a" , "b" , "c" ])
114+ midx2 = MultiIndex .from_product ([[1 , 2 ], [3 , 4 ]], names = ["a" , "b" ])
116115
117116 result = midx1 .join (midx2 , return_indexers = False )
118117 tm .assert_index_equal (result , midx1 )
0 commit comments