@@ -461,23 +461,26 @@ def test_merge_na_keys(self):
461461 tm .assert_frame_equal (result , expected )
462462
463463 def test_merge_datetime_index_empty_df (self ):
464- data = [
465- [pd .Timestamp ("1950-01-01" ), "A" , 1.5 ],
466- [pd .Timestamp ("1950-01-02" ), "B" , 1.5 ],
467- ]
468464
469- frame = DataFrame (data , columns = ["date" , "panel" , "data" ]).set_index (
465+ date = np .array (
466+ [pd .Timestamp ("1950-01-01" ), pd .Timestamp ("1950-01-02" )],
467+ dtype = np .datetime64 ,
468+ )
469+ panel = np .array (["A" , "B" ], dtype = object )
470+ data = np .array ([1.5 , 1.5 ], dtype = np .float64 )
471+
472+ frame = DataFrame ({"date" : date , "panel" : panel , "data" : data }).set_index (
470473 ["date" , "panel" ]
471474 )
472475 other = DataFrame (columns = ["date" , "panel" , "state" ]).set_index (
473476 ["date" , "panel" ]
474477 )
475- expected_data = [
476- [pd .Timestamp ("1950-01-01" ), "A" , 1.5 , pd .NA ],
477- [pd .Timestamp ("1950-01-02" ), "B" , 1.5 , pd .NA ],
478- ]
479478
480- expected = DataFrame (expected_data , columns = ["date" , "panel" , "data" , "state" ])
479+ state = np .array ([np .nan , np .nan ], dtype = object )
480+
481+ expected = DataFrame (
482+ {"date" : date , "panel" : panel , "data" : data , "state" : state }
483+ )
481484 expected = expected .set_index (["date" , "panel" ])
482485
483486 result = frame .merge (other , how = "left" , on = ["date" , "panel" ])
0 commit comments