Skip to content

Commit 75a4976

Browse files
committed
reformat from pd.NA
1 parent 21caa82 commit 75a4976

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
@@ -459,23 +459,26 @@ def test_merge_na_keys(self):
459459
tm.assert_frame_equal(result, expected)
460460

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

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

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

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

0 commit comments

Comments
 (0)