@@ -1420,19 +1420,17 @@ def test_lookup_float(self, float_frame):
1420
1420
cols = list (df .columns ) * len (df .index )
1421
1421
result = df .lookup (rows , cols )
1422
1422
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 )
1425
1425
1426
1426
def test_lookup_mixed (self , float_string_frame ):
1427
1427
df = float_string_frame
1428
1428
rows = list (df .index ) * len (df .columns )
1429
1429
cols = list (df .columns ) * len (df .index )
1430
1430
result = df .lookup (rows , cols )
1431
1431
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 )
1436
1434
1437
1435
def test_lookup_bool (self ):
1438
1436
df = DataFrame (
@@ -1443,14 +1441,16 @@ def test_lookup_bool(self):
1443
1441
"mask_c" : [False , True , False , True ],
1444
1442
}
1445
1443
)
1446
- df [ "mask" ] = df .lookup (df .index , "mask_" + df ["label" ])
1444
+ df_mask = df .lookup (df .index , "mask_" + df ["label" ])
1447
1445
1448
- exp_mask = np . array (
1446
+ exp_mask = Series (
1449
1447
[df .loc [r , c ] for r , c in zip (df .index , "mask_" + df ["label" ])]
1450
1448
)
1451
1449
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_
1454
1454
1455
1455
def test_lookup_raises (self , float_frame ):
1456
1456
with pytest .raises (KeyError , match = "'One or more row labels was not found'" ):
0 commit comments