-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
WIP: Add DayEnd, DayBegin Offsets (Help Wanted) #27087
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
Hello @pilkibun! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:
Comment last updated at 2019-06-28 15:50:51 UTC |
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.
does .normalize() not actually do this already?
You're right, it does make But since all other offsets seem to come in pairs, and for symmetry, I thought it's best to provide it. Not attached to it, though. |
I'm -1 for adding more offests especially in this case where |
@mroeschke, what then is the idiomatic way for the equivalent of |
We haven't seen any demand for |
idiomatically we already an do this pretty easily; though I am not sure of an actual usecase that you would need this
|
Compare (after #27090) df.ceil('DE') which matches what you currently use if you want end of month: df.ceil('M') a day is just another frequency, it's bad usability to require entirely different ways to accomplish what is essentially the same thing. |
I still think this would be useful, but the silence on this strongly suggests a definite no. |
This is missing tests, but I'm not sure I'm doing this properly (timezones, DST) so comments/advice welcome. If reviewers are inclined to merge a complete PR, I'll gladly add the missing tests.
I think the
+timedelta(days=1,nanoseconds=-1)
trick is safe, pytz database shows no dst transitions at midnight in the history of the world, though I encounter a trippy "non-existent time" Exception, which should merit an achievement badge in some other context.I needed
DayEnd
in #26959, when you want to compute rolling stat by day, and you want the window backward to always be from the end of the day, not whatever random time the last event that day occurred.related #7049, insofar as users have a need for a wider range of aliases then supported.