-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
ENH/BUG: Offset.apply dont preserve time #7375
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
@@ -1208,7 +1395,7 @@ def test_offset(self): | |||
def test_normalize(self): | |||
dt = datetime(2007, 1, 1, 3) | |||
|
|||
result = dt + BMonthEnd() | |||
result = dt + BMonthEnd(normalize=True) |
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.
Is this an API change?
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.
Depends on definition. Whether to regard BMonthEnd
and MonthEnd
inconsistencies are spec or bug. From users point of view, I think it looks a bug as most of other offsets behave differently.
@@ -115,8 +115,19 @@ Enhancements | |||
- Implemented ``sem`` (standard error of the mean) operation for ``Series``, | |||
``DataFrame``, ``Panel``, and ``Groupby`` (:issue:`6897`) | |||
|
|||
- All ``offsets`` suppports ``normalize`` keyword to specify whether ``offsets.apply``, ``rollforward`` and ``rollback`` resets time (hour, minute, etc) or not (default ``False``, preserves time) (:issue:`7156`) |
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.
why don't you move these to API section (they technically are a missing 'feature', but just to make it obvious)
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.
looks fine, pls move to API section, then good 2 go
@jreback Moved the description to API, and rebased. |
ENH/BUG: Offset.apply dont preserve time
@jreback While trying to clean up the whatsnew page for 0.14.1, I wanted to rewrite the api change on the offsets a bit (as it is now not clear what did change), but I stumbled on this:
So for |
cc @sinhrks ? |
Actually, looking at the dev docs now, and the example of Correction: in the docs it is correct (with |
yes it looks like a bug with Day which is handled in Tick |
Yes, it is a bug. Currently |
And the And yet something else:
|
can u separate out the fix for this into a new pr? |
@jreback Sure, will do shortly. @jorisvandenbossche |
@sinhrks In theory |
OK. Is it correct |
@sinhrks that's correct (I personally find that pretty confusing), as so its a semi-private method (and one should really use |
I created seperate issues for the YearOffset and MonthOffset issues I reported here. But do I understand correctly that they are not really 'meant to be used' like this? As I expect
|
@jorisvandenbossche its iffy. I don't see any explicty usage of them in docs/otherwise I think the idea was that once could have it programatically select the class, e.g.
which does seem useful. Maybe need to figure out use/doc it (or clearly mark it as semi-private). |
I was just updating my comment above: |
sorry, I mean |
but |
The problem it is that
|
aha, so the |
I think the contructor is ok, it needs an apply (kind of like The question remains are |
I think this is related as well: #4804 |
If we decide they are not public, they should get a For the rest I can't really say if they should be public or not, I find all this offset stuff quite confusing, and the docs are rather scarce. |
ok, you have highlited the issues, I don't think its hard to 'fix' them to be correct. Let's do that, then maybe can expand the docs a bit / improve doc-strings. |
Closes #7156.