Skip to content

Commit

Permalink
fixup test
Browse files Browse the repository at this point in the history
  • Loading branch information
jorisvandenbossche committed Feb 18, 2025
1 parent 5645c3e commit b28362f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pandas/tests/indexing/test_loc.py
Original file line number Diff line number Diff line change
Expand Up @@ -2084,10 +2084,15 @@ def test_loc_setitem_datetime_keys_cast(self, conv, using_infer_string):
df.loc[conv(dt1), "one"] = 100
df.loc[conv(dt2), "one"] = 200

# the dtype constructed by Index([..]) does not yet follow the unit
# of the input on 2.3.x -> so checking this is datetime64, but then
# specifying the exact dtype in the expected result
assert df.index.dtype.kind == "M"
expected = DataFrame(
{"one": [100.0, 200.0]},
index=Index(
[conv(dt1), conv(dt2)], dtype=None if using_infer_string else object
[conv(dt1), conv(dt2)],
dtype=df.index.dtype if using_infer_string else object,
),
columns=Index(["one"]),
)
Expand Down

0 comments on commit b28362f

Please sign in to comment.