-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: Timestamp.unit now reflects changes in components after Timestamp.replace #58121
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BUG: Timestamp.unit now reflects changes in components after Timestamp.replace #58121
Conversation
c3a4ebf
to
5a62136
Compare
Hey, I've made the requested changes. |
@jbrockmendel @mroeschke Hey!! Sorry for the ping but it's been a while since I last heard from you, is this change still of interest? Let me know If you need anything from me :) |
@jbrockmendel I see you made a change on this files recently, does this still work as intended? |
Hey @mroeschke after speaking with him it is of my understanding that @jbrockmendel is taking some time mostly-off contributing for pandas, he indicated that you might be able to review this in the meantime? thanks in advance |
765e7ee
to
13fdc2a
Compare
Could you add a test like ts = pd.Timestamp(year=2020, month=1, day=1, nanosecond=5)
result = ts.replace(nanosecond=0)
assert result.unit == "s" |
@mroeschke In fact that logic was not yet implemented, thank you for noticing! I have attempted to solve the issue by registering if a replacement with 0 was made and if so add an extra check to recalculate the replacement resolution. The test now passes successfully. |
5e6c223
to
d2c9a04
Compare
d2c9a04
to
ff9f0f6
Compare
@mroeschke Hey, I've added the test cases requested!! Had to change some things in the logic but I believe it's working as intended now. |
…ecalculate precision
ff9f0f6
to
f2ca887
Compare
Thanks for the pull request, but it appears to have gone stale. If interested in continuing, please merge in the main branch, address any review comments and/or failing tests, and we can reopen. |
Timestamp.unit
should reflect changes in components afterTimestamp.replace
#57749doc/source/whatsnew/v3.0.0.rst
The logic behind this is having the
Timestamp.unit
set as the most precise unit changed onTimestamp.replace
if one is more precise than the previous set.