BUG: Fix dt64[non_nano] + some_offsets incorrectly rounding
- [ ] closes #56586 (Replace xxxx with the GitHub issue number)
- [ ] Tests added and passed if fixing a bug or adding a new feature
This PR updates logic selects the finest unit between the array and the offset, preventing rounding errors. A regression test is included to confirm correct behavior for affected offsets and units.
Please let me know if my approach or fix needs any improvements . I’m open to feedback and happy to make changes based on suggestions. Thankyou !
Hi @jbrockmendel I think i might be a bit lost here. Could you please guide me if i’m heading in the wrong direction? Thank you!
@jbrockmendel Thanks for the review and the corrections. Only one test failure is left now.
FAILED pandas/tests/arrays/test_datetimes.py::test_dt64_non_nano_offset_no_rounding - AttributeError: 'datetime.datetime' object has no attribute 'tz_localize'
I’m a bit confused about this assertion error, it shows up in ci, but I’m unable to reproduce it locally.
0.01s call pandas/tests/arrays/test_datetimes.py::TestDatetimeArray::test_iter_zoneinfo_fold[pytz/US/Eastern]
0.01s call pandas/tests/arrays/test_datetimes.py::test_dt64_non_nano_offset_no_rounding
============================ 2474 passed in 11.70s =============================