Skip to content

REF: de-duplicate precision_from_unit attempt 2 #51594

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

Merged
merged 3 commits into from
Feb 24, 2023

Conversation

jbrockmendel
Copy link
Member

@jbrockmendel jbrockmendel commented Feb 23, 2023

precision_from_unit is getting called in situations where it shouldn't be.

@mroeschke mroeschke added Refactor Internal refactoring of code Non-Nano datetime64/timedelta64 with non-nanosecond resolution labels Feb 23, 2023
Copy link
Member

@MarcoGorelli MarcoGorelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good - left a comment about the error from precision_from_unit not propagating through get_conversion_factor, but feel free to ignore if you disagree, not a blocker

else:
raise ValueError(f"cannot cast unit {unit}")
m = get_conversion_factor(reso, out_reso)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if get_conversion_factor raises, then precision_from_unit wouldn't propagate the error - perhaps a note could be made about this in the docstring, alongside the current note?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment sounds good

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to keep from clogging the CI, mind if i add this comment in my next CLN: assorted branch?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sounds good!

@MarcoGorelli MarcoGorelli added this to the 2.1 milestone Feb 24, 2023
@MarcoGorelli MarcoGorelli merged commit 7e19f39 into pandas-dev:main Feb 24, 2023
@jbrockmendel jbrockmendel deleted the ref-precision_from_unit-2 branch February 24, 2023 19:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Non-Nano datetime64/timedelta64 with non-nanosecond resolution Refactor Internal refactoring of code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants