Skip to content

Commit 70651d1

Browse files
committed
reformat from pd.NA
1 parent d85af30 commit 70651d1

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

pandas/tests/reshape/merge/test_multi.py

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -458,23 +458,26 @@ def test_merge_na_keys(self):
458458
tm.assert_frame_equal(result, expected)
459459

460460
def test_merge_datetime_index_empty_df(self):
461-
data = [
462-
[pd.Timestamp("1950-01-01"), "A", 1.5],
463-
[pd.Timestamp("1950-01-02"), "B", 1.5],
464-
]
465461

466-
frame = DataFrame(data, columns=["date", "panel", "data"]).set_index(
462+
date = np.array(
463+
[pd.Timestamp("1950-01-01"), pd.Timestamp("1950-01-02")],
464+
dtype=np.datetime64,
465+
)
466+
panel = np.array(["A", "B"], dtype=object)
467+
data = np.array([1.5, 1.5], dtype=np.float64)
468+
469+
frame = DataFrame({"date": date, "panel": panel, "data": data}).set_index(
467470
["date", "panel"]
468471
)
469472
other = DataFrame(columns=["date", "panel", "state"]).set_index(
470473
["date", "panel"]
471474
)
472-
expected_data = [
473-
[pd.Timestamp("1950-01-01"), "A", 1.5, pd.NA],
474-
[pd.Timestamp("1950-01-02"), "B", 1.5, pd.NA],
475-
]
476475

477-
expected = DataFrame(expected_data, columns=["date", "panel", "data", "state"])
476+
state = np.array([np.nan, np.nan], dtype=object)
477+
478+
expected = DataFrame(
479+
{"date": date, "panel": panel, "data": data, "state": state}
480+
)
478481
expected = expected.set_index(["date", "panel"])
479482

480483
result = frame.merge(other, how="left", on=["date", "panel"])

0 commit comments

Comments
 (0)