Skip to content

API/ENH: tz_localize handling of nonexistent times: rename keyword + add shift option #22644

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 64 commits into from
Oct 25, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
bf5e7bf
ENH: Add handling of nonexistent times
Sep 4, 2018
36d13c7
Merge remote-tracking branch 'upstream/master' into normalize_tz
Sep 5, 2018
a5ea445
Merge remote-tracking branch 'upstream/master' into normalize_tz
Sep 7, 2018
8753d00
correct misspelling
Sep 7, 2018
e1a6c6a
Merge remote-tracking branch 'upstream/master' into normalize_tz
Sep 7, 2018
a7c86c8
Merge remote-tracking branch 'upstream/master' into normalize_tz
Sep 8, 2018
1884c7b
Merge remote-tracking branch 'upstream/master' into normalize_tz
Sep 8, 2018
a6a05df
change method of handling nonexistent times
Sep 8, 2018
c4dc8aa
Add another comment
Sep 8, 2018
1bc81db
Add tests for timestamps
Sep 9, 2018
c81d58c
Add tests for datetimeindex
Sep 9, 2018
b2c8429
Add series test and entry in timeseries.rst
Sep 9, 2018
a65987d
Add whatsnew
Sep 9, 2018
710014c
Clean up docstring
Sep 9, 2018
93159e5
Fix nat doc
Sep 9, 2018
a0ffcdd
Merge remote-tracking branch 'upstream/master' into normalize_tz
Sep 11, 2018
219256f
Merge remote-tracking branch 'upstream/master' into normalize_tz
Sep 11, 2018
d435481
Merge remote-tracking branch 'upstream/master' into normalize_tz
Sep 14, 2018
7c849b6
Merge remote-tracking branch 'upstream/master' into normalize_tz
Sep 14, 2018
56ac4fe
Merge remote-tracking branch 'upstream/master' into normalize_tz
Sep 14, 2018
b7b09bd
Merge remote-tracking branch 'upstream/master' into normalize_tz
Sep 19, 2018
94a72a5
add versionadded
Sep 19, 2018
39b769e
Remove whitespace
Sep 19, 2018
18664d8
Merge remote-tracking branch 'upstream/master' into normalize_tz
Sep 24, 2018
8852d43
Depreciate errors and see what needs warning captures
Sep 24, 2018
38b95e9
Correct NaT docstring
Sep 24, 2018
c88b0d8
edit whatsnew and check for raised DeprecationWarning
Sep 24, 2018
1bae682
Address review
Sep 26, 2018
d30f891
change default errors argument to None
Sep 26, 2018
f337692
Map depreciation correctly and test
Sep 26, 2018
6a12a7e
Merge remote-tracking branch 'upstream/master' into normalize_tz
Sep 26, 2018
a7b8357
Try to correctly test for FutureWarning
Sep 26, 2018
7ad87ec
Try adjusting catching FutureWarning
Sep 27, 2018
abad726
Merge remote-tracking branch 'upstream/master' into normalize_tz
Sep 27, 2018
6be1c25
Reorder context managers
Sep 27, 2018
f8be4b6
clear previously seen FutureWarning
Sep 28, 2018
c192c9f
separate test
Sep 28, 2018
8909f38
Merge remote-tracking branch 'upstream/master' into normalize_tz
Sep 28, 2018
49f203f
Merge remote-tracking branch 'upstream/master' into normalize_tz
Sep 30, 2018
01678c7
adjust test
Sep 30, 2018
707fdde
Merge remote-tracking branch 'upstream/master' into normalize_tz
Sep 30, 2018
ae27a50
Remove errors argument to tz_localize_to_utc
Sep 30, 2018
85ed25e
Merge remote-tracking branch 'upstream/master' into normalize_tz
Oct 3, 2018
9041ebe
Add nonexistent assert
Oct 4, 2018
a4cdac2
Handle default None arg
Oct 5, 2018
0a9c1db
Merge remote-tracking branch 'upstream/master' into normalize_tz
Oct 5, 2018
efb382e
Address review
Oct 6, 2018
61c73ca
Catch another warning
Oct 6, 2018
20cc925
Merge remote-tracking branch 'upstream/master' into normalize_tz
Oct 7, 2018
394a0db
Add extra docstring
Oct 7, 2018
a5253ee
Merge remote-tracking branch 'upstream/master' into normalize_tz
Oct 8, 2018
5185683
Edit whatsnew
Oct 8, 2018
ba1bfed
Merge remote-tracking branch 'upstream/master' into normalize_tz
Oct 11, 2018
8b06c96
Address comments
Oct 11, 2018
42ae923
Remove stacklevel
Oct 12, 2018
fe575fe
Add back check_stacklevel
Oct 12, 2018
3482f92
Add blank line for rendering
Oct 17, 2018
f0e43e2
Merge remote-tracking branch 'upstream/master' into normalize_tz
Oct 18, 2018
b98d4cf
Merge remote-tracking branch 'upstream/master' into normalize_tz
Oct 18, 2018
e6c5b2d
Validate nonexistent argument
Oct 18, 2018
83423ad
Merge remote-tracking branch 'upstream/master' into normalize_tz
Oct 19, 2018
1ca0ab2
Fix type
Oct 19, 2018
5bcc977
Merge remote-tracking branch 'upstream/master' into normalize_tz
Oct 24, 2018
8cf16e2
Merge remote-tracking branch 'upstream/master' into normalize_tz
Oct 24, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Depreciate errors and see what needs warning captures
  • Loading branch information
Matt Roeschke committed Sep 24, 2018
commit 8852d430fbd4119e56d8ef46b480743a26621e1f
7 changes: 6 additions & 1 deletion pandas/_libs/tslibs/conversion.pyx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# -*- coding: utf-8 -*-
import warnings

import cython
from cython import Py_ssize_t
Expand Down Expand Up @@ -860,9 +861,13 @@ def tz_localize_to_utc(ndarray[int64_t] vals, object tz, object ambiguous=None,
bint is_coerce = errors == 'coerce', is_raise = errors == 'raise'

# Vectorized version of DstTzInfo.localize

assert is_coerce or is_raise

if is_coerce:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we do the warning at a higher level? eg. not in the cython code? IOW refactor to avoid passing errors at all

warnings.warn("the errors argument is deprecated, will be removed "
"in a future release. Use the ambiguous or nonexistent "
"argument instead.", DeprecationWarning)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use FutureWarning


if tz == UTC or tz is None:
return vals

Expand Down
2 changes: 1 addition & 1 deletion pandas/_libs/tslibs/timestamps.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -930,7 +930,7 @@ class Timestamp(_Timestamp):
- 'coerce' will return NaT if the timestamp can not be converted
into the specified timezone

.. versionadded:: 0.19.0
.. depreciated:: 0.24.0

Returns
-------
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/arrays/datetimes.py
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,7 @@ def tz_localize(self, tz, ambiguous='raise', nonexistent='raise',
- 'coerce' will return NaT if the timestamp can not be converted
to the specified time zone

.. versionadded:: 0.19.0
.. depreciated:: 0.24.0

Returns
-------
Expand Down