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
Addition of two DateOffsets #10902
Comments
These do not form composite objects. I suppose they could, but not sure if it has a useful case as these can operate directly on Series/Timestamps. @aickley pls show the utility here. |
This would be useful when 1) offsets are defined at a different place from where there are used and 2) when offsets are defined relative to each other. For instance, currently I have some code conceptually similar to # Parameters of a study
predictors_window_bdays = 3
predictors_window_end = DateOffset(...) # offset from an event
predictors_window_start = predictors_window_start - DateOffset(bdays=predictors_window_bdays)
# response_window_{bdays,start,end} defined similarly
# The code where the real work is done
# events is a DatetimeIndex()
x = predictors.ix[events+predictors_window_end] - predictors.ix[events+predictors_window_start]
y = response.ix[events+response_window_end] - response.ix[events+response_window_start]
# analyze the relationship between x and y Now it is not possible to specify As a workaround, I am currently storing lists of |
This is currently not allowed because adding anything to a But if you have So aside from I'll leave it open for you to provide a reasonable proof-of-concept. |
For non-business days I suppose these could be combinable as e.g.
|
Ok, I understand that Apart from that, combining BTW, surprisingly enough, now one can combine
and the result is different from the direct application
which is clearly a bug. The same applies to |
@aickley It's not so clear to me that's a bug, because The way addition of a delta on BDay works right now is that the offset remains a E.g:
This definition actually makes sense if you think of the delta as an 'anchored' offset - that is, 1:00 on each business day. But it may be less surprising if the sign/count propagated to the additional delta and that maybe could be changed. It is a bit ambiguous / surprising. In any case, I'm not seeing why you can't just apply multiple |
Yeah I think this has been disallowed specifically as it raises a TypeError now and due to #10902 (comment) probably not easy to support so closing |
It is convenient to be able to add one DateOffset to another one:
Currently it is not supported. Note that
DateOffset
s basically replicates the functionality ofrelativedelta
s fromdateutil
module which support additionThe text was updated successfully, but these errors were encountered: