-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
ENH: Support datetime.timezone objects #25065
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
jreback
merged 31 commits into
pandas-dev:master
from
mroeschke:datetime_timezone_object_support
Mar 19, 2019
Merged
Changes from 10 commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
8ff8024
ENH: Support datetime.timezone objects
4ade114
Merge remote-tracking branch 'upstream/master' into datetime_timezone…
8ff047b
add comment and simplify check
5076045
flake8 and modify check
f819b26
Remove check
98c3fd2
cdef timezone.utc
224fcc9
cannot cdef tzinfo
b3634f4
PY3.5 support
2a082ed
Merge remote-tracking branch 'upstream/master' into datetime_timezone…
bfb2fd3
Add whatsnew
35b475e
Merge remote-tracking branch 'upstream/master' into datetime_timezone…
a8f163e
clarify whatsnew
07e9b57
Merge remote-tracking branch 'upstream/master' into datetime_timezone…
fcf84ae
update note in timeseries.rst
6d9af30
Merge remote-tracking branch 'upstream/master' into datetime_timezone…
af64d24
Merge remote-tracking branch 'upstream/master' into datetime_timezone…
f052721
Merge remote-tracking branch 'upstream/master' into datetime_timezone…
ac34a1b
Merge remote-tracking branch 'upstream/master' into datetime_timezone…
12e163d
Merge remote-tracking branch 'upstream/master' into datetime_timezone…
a98d1fa
Merge remote-tracking branch 'upstream/master' into datetime_timezone…
c3d01bf
Merge remote-tracking branch 'upstream/master' into datetime_timezone…
9f44011
Merge remote-tracking branch 'upstream/master' into datetime_timezone…
6649396
Merge remote-tracking branch 'upstream/master' into datetime_timezone…
b8354c2
Merge remote-tracking branch 'upstream/master' into datetime_timezone…
d74673e
Address comments
c0ad4b4
Remove extra or
96e068b
Add versionadded tag
67de9c0
Merge remote-tracking branch 'upstream/master' into datetime_timezone…
956822d
Merge remote-tracking branch 'upstream/master' into datetime_timezone…
a843ae1
Merge remote-tracking branch 'upstream/master' into datetime_timezone…
1c6165b
Merge remote-tracking branch 'upstream/master' into datetime_timezone…
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
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
# -*- coding: utf-8 -*- | ||
from datetime import timezone | ||
|
||
# dateutil compat | ||
from dateutil.tz import ( | ||
|
@@ -23,11 +24,12 @@ from pandas._libs.tslibs.util cimport ( | |
is_string_object, is_integer_object, get_nat) | ||
|
||
cdef int64_t NPY_NAT = get_nat() | ||
cdef object utc_stdlib = timezone.utc | ||
|
||
# ---------------------------------------------------------------------- | ||
|
||
cpdef inline bint is_utc(object tz): | ||
return tz is UTC or isinstance(tz, _dateutil_tzutc) | ||
return tz is UTC or isinstance(tz, _dateutil_tzutc) or tz is utc_stdlib | ||
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. Potential micro optimization: I suspect that |
||
|
||
|
||
cdef inline bint is_tzlocal(object tz): | ||
|
@@ -167,6 +169,8 @@ cdef inline bint is_fixed_offset(object tz): | |
return 1 | ||
else: | ||
return 0 | ||
# This also implicitly accepts datetime.timezone objects which are | ||
# considered fixed | ||
return 1 | ||
|
||
|
||
|
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
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.
can you add a :meth: with a ref to the python docs
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.
add where they are supported