-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
DEPR: deprecate integer add/sub with DTI/TDI/PI/Timestamp/Period #22535
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
Merged
Merged
Changes from all commits
Commits
Show all changes
40 commits
Select commit
Hold shift + click to select a range
145eb6a
DEPR: deprecate integer add/sub with DTI/TDI/PI/Timestamp/Period
jbrockmendel d5c5f28
say future version instead of a specific version number
jbrockmendel 3fb29bc
Merge branch 'master' of https://github.com/pandas-dev/pandas into in…
jbrockmendel 81c9eab
typo fixup
jbrockmendel 26c9966
Catch FutureWarning/PerformanceWarning in tests
jbrockmendel 11959b1
Merge branch 'master' of https://github.com/pandas-dev/pandas into in…
jbrockmendel 8952cb5
set stacklevel
jbrockmendel 7c79364
Merge branch 'master' of https://github.com/pandas-dev/pandas into in…
jbrockmendel d0fa41a
Avoid warnings in plotting._converter
jbrockmendel c23346b
Merge branch 'master' of https://github.com/pandas-dev/pandas into in…
jbrockmendel f6daf34
Merge branch 'master' of https://github.com/pandas-dev/pandas into in…
jbrockmendel b7e3dcf
Fixup flipped condition
jbrockmendel 2a829d3
Merge branch 'master' of https://github.com/pandas-dev/pandas into in…
jbrockmendel f24643c
whatsnew section on deprecation
jbrockmendel 6fea2a8
Merge branch 'master' of https://github.com/pandas-dev/pandas into in…
jbrockmendel b469bef
just input in whatsnew executable block
jbrockmendel 20d58fa
Catch warnings in tests
jbrockmendel 984bc7e
TST: catch warnings for strict test run
jbrockmendel 841718c
Merge branch 'master' of https://github.com/pandas-dev/pandas into in…
jbrockmendel 7e7a348
Catch warnings
jbrockmendel 17f6be0
Avoid warnings
jbrockmendel 29cca46
catch more warnings
jbrockmendel b0a222a
avoid warning
jbrockmendel 14b9eaf
Merge branch 'master' of https://github.com/pandas-dev/pandas into in…
jbrockmendel 55dc265
Avoid need to catch deprecation warnings
jbrockmendel 9443df9
stop using deprecated usage
jbrockmendel d46452d
Merge branch 'master' of https://github.com/pandas-dev/pandas into in…
jbrockmendel af31b0c
Merge branch 'master' of https://github.com/pandas-dev/pandas into in…
jbrockmendel 0bebbe0
Merge branch 'master' of https://github.com/pandas-dev/pandas into in…
jbrockmendel c7dd7ce
update to user PeriodArray private method
jbrockmendel ca55b4a
Merge branch 'master' of https://github.com/pandas-dev/pandas into in…
jbrockmendel 394a3b8
suppress
jbrockmendel 3884bb4
Merge branch 'master' of https://github.com/pandas-dev/pandas into in…
jbrockmendel a15d9e4
Merge branch 'master' of https://github.com/pandas-dev/pandas into in…
jbrockmendel 5256671
function for warning
jbrockmendel d8865d7
ignore stacklevel
jbrockmendel da72660
Merge branch 'master' of https://github.com/pandas-dev/pandas into in…
jbrockmendel fcd65b3
Show deprecation warning in whatsnew
jbrockmendel 6ded8b1
move location of addsub_int_array warning
jbrockmendel 4a7b589
rename deprecation warning function
jbrockmendel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -955,6 +955,56 @@ Deprecations | |
- :meth:`Timestamp.tz_localize`, :meth:`DatetimeIndex.tz_localize`, and :meth:`Series.tz_localize` have deprecated the ``errors`` argument in favor of the ``nonexistent`` argument (:issue:`8917`) | ||
- The class ``FrozenNDArray`` has been deprecated. When unpickling, ``FrozenNDArray`` will be unpickled to ``np.ndarray`` once this class is removed (:issue:`9031`) | ||
|
||
.. _whatsnew_0240.deprecations.datetimelike_int_ops: | ||
|
||
Integer Addition/Subtraction with Datetime-like Classes Is Deprecated | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
In the past, users could add or subtract integers or integer-dtypes arrays | ||
from :class:`Period`, :class:`PeriodIndex`, and in some cases | ||
:class:`Timestamp`, :class:`DatetimeIndex` and :class:`TimedeltaIndex`. | ||
|
||
This usage is now deprecated. Instead add or subtract integer multiples of | ||
the object's ``freq`` attribute (:issue:`21939`) | ||
|
||
Previous Behavior: | ||
|
||
.. code-block:: ipython | ||
|
||
In [3]: per = pd.Period('2016Q1') | ||
In [4]: per + 3 | ||
Out[4]: Period('2016Q4', 'Q-DEC') | ||
|
||
In [5]: ts = pd.Timestamp('1994-05-06 12:15:16', freq=pd.offsets.Hour()) | ||
In [6]: ts + 2 | ||
Out[6]: Timestamp('1994-05-06 14:15:16', freq='H') | ||
|
||
In [7]: tdi = pd.timedelta_range('1D', periods=2) | ||
In [8]: tdi - np.array([2, 1]) | ||
Out[8]: TimedeltaIndex(['-1 days', '1 days'], dtype='timedelta64[ns]', freq=None) | ||
|
||
In [9]: dti = pd.date_range('2001-01-01', periods=2, freq='7D') | ||
In [10]: dti + pd.Index([1, 2]) | ||
Out[10]: DatetimeIndex(['2001-01-08', '2001-01-22'], dtype='datetime64[ns]', freq=None) | ||
|
||
Current Behavior: | ||
|
||
.. ipython:: python | ||
:okwarning: | ||
per = pd.Period('2016Q1') | ||
per + 3 | ||
|
||
per = pd.Period('2016Q1') | ||
per + 3 * per.freq | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you might want to show the deprecation warning itself on 1 case here (you will need to add |
||
ts = pd.Timestamp('1994-05-06 12:15:16', freq=pd.offsets.Hour()) | ||
ts + 2 * ts.freq | ||
|
||
tdi = pd.timedelta_range('1D', periods=2) | ||
tdi - np.array([2 * tdi.freq, 1 * tdi.freq]) | ||
|
||
dti = pd.date_range('2001-01-01', periods=2, freq='7D') | ||
dti + pd.Index([1 * dti.freq, 2 * dti.freq]) | ||
|
||
.. _whatsnew_0240.prior_deprecations: | ||
|
||
Removal of prior version deprecations/changes | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
these should be executable statements, e.g. just show the input, the output is run
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.
Updated. One day I'll get the hang of this doc system...
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.
if you can update these
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.
you don't need the ipython line numbers