-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
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
Changes from 4 commits
bf5e7bf
36d13c7
a5ea445
8753d00
e1a6c6a
a7c86c8
1884c7b
a6a05df
c4dc8aa
1bc81db
c81d58c
b2c8429
a65987d
710014c
93159e5
a0ffcdd
219256f
d435481
7c849b6
56ac4fe
b7b09bd
94a72a5
39b769e
18664d8
8852d43
38b95e9
c88b0d8
1bae682
d30f891
f337692
6a12a7e
a7b8357
7ad87ec
abad726
6be1c25
f8be4b6
c192c9f
8909f38
49f203f
01678c7
707fdde
ae27a50
85ed25e
9041ebe
a4cdac2
0a9c1db
efb382e
61c73ca
20cc925
394a0db
a5253ee
5185683
ba1bfed
8b06c96
42ae923
fe575fe
3482f92
f0e43e2
b98d4cf
e6c5b2d
83423ad
1ca0ab2
5bcc977
8cf16e2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -980,6 +980,8 @@ class Timestamp(_Timestamp): | |||||
- 'raise' will raise an AmbiguousTimeError for an ambiguous time | ||||||
|
||||||
nonexistent : 'shift', 'NaT', default 'raise' | ||||||
jorisvandenbossche marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
A nonexistent time doesn't not exist in a particular timezone | ||||||
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.
Suggested change
|
||||||
where clocks moved forward due to DST. | ||||||
- 'shift' will shift the nonexistent time forward to the closest | ||||||
existing time | ||||||
- 'NaT' will return NaT where there are nonexistent times | ||||||
|
@@ -1013,8 +1015,7 @@ class Timestamp(_Timestamp): | |||||
warnings.warn("The errors argument is deprecated and will be " | ||||||
"removed in a future release. Use " | ||||||
"nonexistent='NaT' or nonexistent='raise' " | ||||||
"instead.", FutureWarning, | ||||||
stacklevel=2) | ||||||
"instead.", FutureWarning) | ||||||
if errors == 'coerce': | ||||||
nonexistent = 'NaT' | ||||||
elif errors == 'raise': | ||||||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -649,6 +649,8 @@ def tz_localize(self, tz, ambiguous='raise', nonexistent='raise', | |||||
times | ||||||
|
||||||
nonexistent : 'shift', 'NaT' default 'raise' | ||||||
A nonexistent time doesn't not exist in a particular timezone | ||||||
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.
Suggested change
|
||||||
where clocks moved forward due to DST. | ||||||
- 'shift' will shift the nonexistent times forward to the closest | ||||||
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. Can you reuse the explanation about what a non-existent time is that is in the (and idem for the other occurences of this in docstrings) |
||||||
existing time | ||||||
- 'NaT' will return NaT where there are nonexistent times | ||||||
|
@@ -711,8 +713,7 @@ def tz_localize(self, tz, ambiguous='raise', nonexistent='raise', | |||||
warnings.warn("The errors argument is deprecated and will be " | ||||||
"removed in a future release. Use " | ||||||
"nonexistent='NaT' or nonexistent='raise' " | ||||||
"instead.", FutureWarning, | ||||||
stacklevel=2) | ||||||
"instead.", FutureWarning) | ||||||
if errors == 'coerce': | ||||||
nonexistent = 'NaT' | ||||||
elif errors == 'raise': | ||||||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -8656,6 +8656,8 @@ def tz_localize(self, tz, axis=0, level=None, copy=True, | |||||
- 'raise' will raise an AmbiguousTimeError if there are ambiguous | ||||||
times | ||||||
nonexistent : 'shift', 'NaT', default 'raise' | ||||||
A nonexistent time doesn't not exist in a particular timezone | ||||||
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.
Suggested change
|
||||||
where clocks moved forward due to DST. | ||||||
- 'shift' will shift the nonexistent times forward to the closest | ||||||
existing time | ||||||
- 'NaT' will return NaT where there are nonexistent times | ||||||
|
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.
Sorry, rst formatting nitpick: there needs to be a blank line between the first sentences, and the start of this list ... (getting rst right can be annoying ..)