-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
API: Localize Series when calling to_datetime with utc=True (#6415) #17109
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
18 commits
Select commit
Hold shift + click to select a range
b846c57
Fxi merge
mroeschke 4319527
BUG: to_datetime not localizing Series when utc=True (#6415)
mroeschke 9a93811
Adjust SQL tests
mroeschke 76471e9
Add whatsnew note about impact on read_sql
mroeschke eed2d3d
PEP8 fixes
mroeschke f56859a
Have DatetimeIndex handle the UTC conversion for Series and reformat …
mroeschke d069b05
Address whatsnew changes & fix sql tests
mroeschke f24b82c
Undo formatting
mroeschke 808a810
Revert SQL test
mroeschke c142975
Address comments and confirm timezone tests
mroeschke e8f5d4e
Ensure expected name matches
mroeschke 4d17722
Fix linting errors
mroeschke 9e9b89e
Whatsnew and tests fixups
mroeschke d466fd2
Address whatsnew and test comments
mroeschke 177b3fe
Fix linting errors
mroeschke 3407830
Fix tests and whatnew notes
mroeschke f9248ad
Remove extra linebreak
mroeschke 5eb7d9c
Double tick Index
mroeschke 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 |
---|---|---|
|
@@ -516,7 +516,7 @@ def _convert_listlike(arg, box, format, name=None, tz=tz): | |
result = arg | ||
elif isinstance(arg, ABCSeries): | ||
from pandas import Series | ||
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. looks like lots of code was removed |
||
values = _convert_listlike(arg._values, False, format) | ||
values = _convert_listlike(arg._values, True, format) | ||
result = Series(values, index=arg.index, name=arg.name) | ||
elif isinstance(arg, (ABCDataFrame, MutableMapping)): | ||
result = _assemble_from_unit_mappings(arg, errors=errors) | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2137,7 +2137,7 @@ def test_set_index_datetime(self): | |
'2011-07-19 08:00:00', '2011-07-19 09:00:00'], | ||
'value': range(6)}) | ||
df.index = pd.to_datetime(df.pop('datetime'), utc=True) | ||
df.index = df.index.tz_localize('UTC').tz_convert('US/Pacific') | ||
df.index = df.index.tz_convert('US/Pacific') | ||
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. Just for future reference, can you explain here why you needed to change this test? |
||
|
||
expected = pd.DatetimeIndex(['2011-07-19 07:00:00', | ||
'2011-07-19 08:00:00', | ||
|
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.
issue number and provide a short expl.