Skip to content

Commit

Permalink
Backport PR #55565 on branch 2.1.x (TST: Remove np.core usage) (#55567)
Browse files Browse the repository at this point in the history
Backport PR #55565: TST: Remove np.core usage

Co-authored-by: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com>
  • Loading branch information
meeseeksmachine and mroeschke committed Oct 18, 2023
1 parent c9053cc commit fd53117
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pandas/tests/frame/constructors/test_from_records.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ def test_from_records_with_datetimes(self):
arrdata = [np.array([datetime(2005, 3, 1, 0, 0), None])]
dtypes = [("EXPIRY", "<M8[ns]")]

recarray = np.core.records.fromarrays(arrdata, dtype=dtypes)
recarray = np.rec.fromarrays(arrdata, dtype=dtypes)

result = DataFrame.from_records(recarray)
tm.assert_frame_equal(result, expected)

# coercion should work too
arrdata = [np.array([datetime(2005, 3, 1, 0, 0), None])]
dtypes = [("EXPIRY", "<M8[m]")]
recarray = np.core.records.fromarrays(arrdata, dtype=dtypes)
recarray = np.rec.fromarrays(arrdata, dtype=dtypes)
result = DataFrame.from_records(recarray)
# we get the closest supported unit, "s"
expected["EXPIRY"] = expected["EXPIRY"].astype("M8[s]")
Expand Down

0 comments on commit fd53117

Please sign in to comment.