-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
BUG: no longer raise user warning when plotting tz aware time series #31207
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
jorisvandenbossche
merged 9 commits into
pandas-dev:master
from
MarcoGorelli:issue-31205
Feb 3, 2020
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
cc56b52
:bug: no longer raise user warning when plotting tz aware time series
55f7aac
:ok_hand: use pandas testing module to check for no warnings, dont ig…
ecbed59
check first point is in correct timezone
MarcoGorelli dc3f95c
remove accidentally committed file
MarcoGorelli a94bf56
simplify regex
MarcoGorelli 363b328
try tz_convert
MarcoGorelli cceca71
debugging CI failure
MarcoGorelli ecd4abb
remove test checking labels
MarcoGorelli 6e2d3ae
revert to tz_localize, as tz_convert didn't help the failing CI test …
MarcoGorelli 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
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 |
---|---|---|
|
@@ -43,19 +43,14 @@ def setup_method(self, method): | |
def teardown_method(self, method): | ||
tm.close() | ||
|
||
# Ignore warning | ||
# ``` | ||
# Converting to PeriodArray/Index representation will drop timezone information. | ||
# ``` | ||
# which occurs for UTC-like timezones. | ||
@pytest.mark.slow | ||
@pytest.mark.filterwarnings("ignore:msg:UserWarning") | ||
def test_ts_plot_with_tz(self, tz_aware_fixture): | ||
# GH2877, GH17173 | ||
# GH2877, GH17173, GH31205 | ||
tz = tz_aware_fixture | ||
MarcoGorelli marked this conversation as resolved.
Show resolved
Hide resolved
|
||
index = date_range("1/1/2011", periods=2, freq="H", tz=tz) | ||
ts = Series([188.5, 328.25], index=index) | ||
_check_plot_works(ts.plot) | ||
with tm.assert_produces_warning(None): | ||
_check_plot_works(ts.plot) | ||
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 add something to check that the points are actually in the correct date-time, e.g. we removed the timezone (checking first/last prob enough) |
||
|
||
def test_fontsize_set_correctly(self): | ||
# For issue #8765 | ||
|
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.
To preserve the existing behaviour, this might need to be
tz_convert
instead oftz_localize
? (the first will give the underlying UTC data, the other converts to naive local time)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.
I would maybe check with a small actual example and see what plotting it gives (on 0.25.3 and on this PR).
Because intuitively, converting to local time zone sounds more useful, though. But not fully sure what the current behaviour is
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.
Here's the output of
on 0.25.3:

On this branch:

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.
@MarcoGorelli can you try with something else as UTC? (as UTC is the one timezone where UTC and local is the same :-))
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.
@jorisvandenbossche sure :)
0.25.3

This branch:
