-
-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
API: datetimeindex subtraction #9094
Comments
We have deprecated the set ops on the index using Are there actually other reasons one would want to use a Then on the naming, is there a reason you have for Sereis both |
@jorisvandenbossche the deprecations don't apply to either Numeric, Datetime, Period, or Timedelta index (IOW, ONLY to Index itself). So dti-dti is a set op. This is NOT deprecated. It could be changed (and maybe should be?) |
hmm, maybe we should deprecate and do the subtraction.
|
@jreback Ah, yes, if we agree on the deprecation of |
ok then i will change DatetimeIndex in 0.16 then to do direct subtraction - makes more sense |
I really thought we had deprecated |
as I commented on the other issue. This is an anomaly and should be fixed (for PeriodIndex) as well. I don't think waiting ANOTHER big release cycle is warranted. |
This is with the latest release 0.15.2:
This is doing a set operation, without a deprecation warning. |
the warning prob should have been there in 0.15 so we'll call this an api change then |
@jreback I think we should revisit this for 0.16 (or at least the deprecation) We do want to be able to do numeric operations, so we should deprecate the set operation (in theory this was already deprecated in 0.15, but for datimeindexes, there was not deprecation warning raised) on master:
|
yes could deprecate the actual subtraction op (which is the only thing left) on dti - dti for 0.16 |
@jorisvandenbossche this is in 0.19.0rc1 right? (need to check the issue) |
Yes, indeed, but this issue was in the end for raising the deprecation warning, so I didn't reference it from the PR (but is could be referenced). PR that changed the setop to timedelta is #14164 |
from SO and previous discussions
currently you cannot subtract 2 datetimeindexes ('-' is actually a set op). This is the ONLY valid numerical type of operation (e.g. you cannot add dti).
We current support pretty much the fully gamut of obvious ops, with
dti-dti
being the exception.full list of tests are here: https://github.com/pydata/pandas/blob/master/pandas/tseries/tests/test_base.py#L434
I will propose
dti.sub(dti)
to rectify thisthoughts
The text was updated successfully, but these errors were encountered: