-
-
Notifications
You must be signed in to change notification settings - Fork 18.6k
Period.end_time should be exclusive or Period should provide duration property #9089
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
Comments
I think the start_time,end_time are consistent and intuitive now. Though I can see when you subtract them you might be suprised. I think more surprising would be an end_time which is NOT included in the advertised Period (e..g. in your example returning
|
|
Yes, |
Apologies, I hadn't realized Timedelta was introduced in 0.15.0. That would seem to be the better type. |
@jreback IIRC there was a semi-recent change to subtract 1 ns from |
yeah i think this is closeable. maybe we should also provide a duration though. |
I don't think this was recent, but already the case when this issue was discussed (at least it is already this behaviour in 0.14). I don't know if it is important enough to keep the issue open, but the original reported problem is still valid I think? Although,
Or is that a purposed change? (this only changed in 0.23) |
A user may expect that the end_time of a Period minus the start_time of a Period returns its duration. Unfortunately, the end_time of a Period is inclusive, consequently, subtracting start from end yields an incorrect period duration:
This can be manually rectified by the user:
However, this is not intuitive.
The end_time should either be exclusive or Period should provide a duration property.
Although a strong argument can be made that the definitions of duration, start_time, and end_time should all be consistent, changing the end_time definition to exclusive is a significant modification of long-standing behavior.
Consequently, I propose the addition of a duration property that is logically inconsistent with subtracting start_time from end_time.
The text was updated successfully, but these errors were encountered: