Skip to content

Commit b28362f

Browse files
fixup test
1 parent 5645c3e commit b28362f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

pandas/tests/indexing/test_loc.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2084,10 +2084,15 @@ def test_loc_setitem_datetime_keys_cast(self, conv, using_infer_string):
20842084
df.loc[conv(dt1), "one"] = 100
20852085
df.loc[conv(dt2), "one"] = 200
20862086

2087+
# the dtype constructed by Index([..]) does not yet follow the unit
2088+
# of the input on 2.3.x -> so checking this is datetime64, but then
2089+
# specifying the exact dtype in the expected result
2090+
assert df.index.dtype.kind == "M"
20872091
expected = DataFrame(
20882092
{"one": [100.0, 200.0]},
20892093
index=Index(
2090-
[conv(dt1), conv(dt2)], dtype=None if using_infer_string else object
2094+
[conv(dt1), conv(dt2)],
2095+
dtype=df.index.dtype if using_infer_string else object,
20912096
),
20922097
columns=Index(["one"]),
20932098
)

0 commit comments

Comments
 (0)