-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
REF: de-duplicate code in libperiod #33491
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
Conversation
pandas/_libs/tslibs/period.pyx
Outdated
subsecond_fraction = second - dts.sec | ||
dts.us = int((subsecond_fraction) * 1e6) | ||
dts.ps = int(((subsecond_fraction) * 1e6 - dts.us) * 1e6) | ||
if freq == FR_US: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
elif on these?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated+green
cc @WillAyd trying to figure out which of the current CI failures are false-positives, is this one from Travis a real problem?
|
I'm assuming your latest commit fixes the issue, but yea I think just telling you that |
|
||
date_info_from_days_and_time(dts, unix_date, abstime) | ||
dt64_to_dtstruct(nanos, &dts2) | ||
dts.hour = dts2.hour |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason you don't just pass the reference to dts in the call above?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because the caller might still need dts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't calling dt64_to_dtstruct do exactly what the next 5 lines of code do anyway?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i can confirm that just passing dts
does Break The World. IIRC part of whats going on here is that dts
may be out of bounds for dt64[ns]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah OK. Thanks for checking - seems strange to have to do this but probably a separate issue then
discussed a few months ago, this gets rid of
date_info_from_days_and_time
and instead re-usespandas_datetime_to_datetimestruct