Skip to content

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

m = multiplier // 1_000_000_000
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

3 participants