-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
BUG: DataFrame/Series.tz_convert does not modifies original data with copy=False #24657
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 all commits
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 |
---|---|---|
|
@@ -348,3 +348,19 @@ def test_series_truncate_datetimeindex_tz(self): | |
result = s.truncate(datetime(2005, 4, 2), datetime(2005, 4, 4)) | ||
expected = Series([1, 2, 3], index=idx[1:4]) | ||
tm.assert_series_equal(result, expected) | ||
|
||
@pytest.mark.parametrize('copy', [True, False]) | ||
@pytest.mark.parametrize('method, tz', [ | ||
['tz_localize', None], | ||
['tz_convert', 'Europe/Berlin'] | ||
]) | ||
def test_tz_localize_convert_copy_inplace_mutate(self, copy, method, tz): | ||
# GH 6326 | ||
result = Series(np.arange(0, 5), | ||
index=date_range('20131027', periods=5, freq='1H', | ||
tz=tz)) | ||
getattr(result, method)('UTC', copy=copy) | ||
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. @mroeschke i'm confused by this; wouldn't we expect the tz in expected.index to be UTC, not 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. The naming of the test is a bit confusing, but this call here should not be an inplace operation. I'm checking that the original data 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. ahh i see. ill update #37498 appropriately |
||
expected = Series(np.arange(0, 5), | ||
index=date_range('20131027', periods=5, freq='1H', | ||
tz=tz)) | ||
tm.assert_series_equal(result, expected) |
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.
this should really have the inplace arg rather than copy as that is the meaning here.
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.
not sure if we should change this api though as don’t really love inplace generally