@@ -1420,19 +1420,17 @@ def test_lookup_float(self, float_frame):
14201420 cols = list (df .columns ) * len (df .index )
14211421 result = df .lookup (rows , cols )
14221422
1423- expected = np . array ([df .loc [r , c ] for r , c in zip (rows , cols )])
1424- tm .assert_numpy_array_equal (result , expected )
1423+ expected = Series ([df .loc [r , c ] for r , c in zip (rows , cols )])
1424+ tm .assert_series_equal (result , expected , check_index = False , check_names = False )
14251425
14261426 def test_lookup_mixed (self , float_string_frame ):
14271427 df = float_string_frame
14281428 rows = list (df .index ) * len (df .columns )
14291429 cols = list (df .columns ) * len (df .index )
14301430 result = df .lookup (rows , cols )
14311431
1432- expected = np .array (
1433- [df .loc [r , c ] for r , c in zip (rows , cols )], dtype = np .object_
1434- )
1435- tm .assert_almost_equal (result , expected )
1432+ expected = Series ([df .loc [r , c ] for r , c in zip (rows , cols )], dtype = np .object_ )
1433+ tm .assert_series_equal (result , expected , check_index = False , check_names = False )
14361434
14371435 def test_lookup_bool (self ):
14381436 df = DataFrame (
@@ -1443,14 +1441,16 @@ def test_lookup_bool(self):
14431441 "mask_c" : [False , True , False , True ],
14441442 }
14451443 )
1446- df [ "mask" ] = df .lookup (df .index , "mask_" + df ["label" ])
1444+ df_mask = df .lookup (df .index , "mask_" + df ["label" ])
14471445
1448- exp_mask = np . array (
1446+ exp_mask = Series (
14491447 [df .loc [r , c ] for r , c in zip (df .index , "mask_" + df ["label" ])]
14501448 )
14511449
1452- tm .assert_series_equal (df ["mask" ], Series (exp_mask , name = "mask" ))
1453- assert df ["mask" ].dtype == np .bool_
1450+ tm .assert_series_equal (
1451+ df_mask , Series (exp_mask , name = "mask" ), check_index = False , check_names = False
1452+ )
1453+ assert df_mask .dtype == np .bool_
14541454
14551455 def test_lookup_raises (self , float_frame ):
14561456 with pytest .raises (KeyError , match = "'One or more row labels was not found'" ):
0 commit comments