-
-
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
Conversation
…tate argument inplace
Codecov Report
@@ Coverage Diff @@
## master #24657 +/- ##
==========================================
- Coverage 92.37% 92.37% -0.01%
==========================================
Files 166 166
Lines 52384 52384
==========================================
- Hits 48391 48390 -1
- Misses 3993 3994 +1
Continue to review full report at Codecov.
|
1 similar comment
Codecov Report
@@ Coverage Diff @@
## master #24657 +/- ##
==========================================
- Coverage 92.37% 92.37% -0.01%
==========================================
Files 166 166
Lines 52384 52384
==========================================
- Hits 48391 48390 -1
- Misses 3993 3994 +1
Continue to review full report at Codecov.
|
@@ -9226,7 +9226,7 @@ def _tz_convert(ax, tz): | |||
ax = _tz_convert(ax, tz) | |||
|
|||
result = self._constructor(self._data, copy=copy) | |||
result.set_axis(ax, axis=axis, inplace=True) |
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
@jreback were your comments from |
this fixes a bug but i think we ought to consider deprecating copy and making it inplace |
OK. A deprecation will take time, so fix in the meantime?
…On Mon, Jan 7, 2019 at 8:51 AM Jeff Reback ***@***.***> wrote:
this fixes a bug but i think we ought to consider deprecating copy and
making it inplace
even though i don’t like that
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#24657 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABQHImeM5kkllqona7QG9q0Ocd22PFoqks5vA17sgaJpZM4Zy727>
.
|
Well the order of operations could be:
|
that’s fine |
Thanks! Made #24667 as a follow up to deprecate |
… copy=False (pandas-dev#24657) * BUG: DataFrame/Series.tz_localize/convert with copy=False does not mutate argument inplace * Put back space
… copy=False (pandas-dev#24657) * BUG: DataFrame/Series.tz_localize/convert with copy=False does not mutate argument inplace * Put back space
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 comment
The 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 tz
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.
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 result
was not modified after calling tz_localize/tz_convert
with copy
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.
ahh i see. ill update #37498 appropriately
git diff upstream/master -u -- "*.py" | flake8 --diff
This also impacted
tz_localize
as well. Non blocking for 0.24