18
18
from pandas .errors import PerformanceWarning , UnsortedIndexError
19
19
from pandas .core .dtypes .dtypes import CategoricalDtype
20
20
from pandas .core .indexes .base import InvalidIndexError
21
- from pandas ._libs import lib
21
+ from pandas .core . dtypes . cast import construct_1d_object_array_from_listlike
22
22
from pandas ._libs .lib import Timestamp
23
23
24
24
import pandas .util .testing as tm
@@ -913,7 +913,7 @@ def test_from_product_invalid_input(self):
913
913
def test_from_product_datetimeindex (self ):
914
914
dt_index = date_range ('2000-01-01' , periods = 2 )
915
915
mi = pd .MultiIndex .from_product ([[1 , 2 ], dt_index ])
916
- etalon = lib . list_to_object_array ([(1 , pd .Timestamp (
916
+ etalon = construct_1d_object_array_from_listlike ([(1 , pd .Timestamp (
917
917
'2000-01-01' )), (1 , pd .Timestamp ('2000-01-02' )), (2 , pd .Timestamp (
918
918
'2000-01-01' )), (2 , pd .Timestamp ('2000-01-02' ))])
919
919
tm .assert_numpy_array_equal (mi .values , etalon )
@@ -938,11 +938,11 @@ def test_values_boxed(self):
938
938
(1 , pd .Timestamp ('2000-01-04' )),
939
939
(2 , pd .Timestamp ('2000-01-02' )),
940
940
(3 , pd .Timestamp ('2000-01-03' ))]
941
- mi = pd .MultiIndex .from_tuples (tuples )
942
- tm . assert_numpy_array_equal ( mi . values ,
943
- lib . list_to_object_array ( tuples ) )
941
+ result = pd .MultiIndex .from_tuples (tuples )
942
+ expected = construct_1d_object_array_from_listlike ( tuples )
943
+ tm . assert_numpy_array_equal ( result . values , expected )
944
944
# Check that code branches for boxed values produce identical results
945
- tm .assert_numpy_array_equal (mi .values [:4 ], mi [:4 ].values )
945
+ tm .assert_numpy_array_equal (result .values [:4 ], result [:4 ].values )
946
946
947
947
def test_append (self ):
948
948
result = self .index [:3 ].append (self .index [3 :])
0 commit comments