-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: alignment changing index on input series #36503
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
pandas/core/generic.py
Outdated
@@ -8835,6 +8839,10 @@ def _align_series( | |||
if is_datetime64tz_dtype(left.index.dtype): | |||
if left.index.tz != right.index.tz: | |||
if join_index is not None: | |||
# GH#33671 ensure we don't change the index on | |||
# our original Series | |||
left = left.copy(deep=False) |
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.
you don't need to deep copy, just .copy()
as that copies the data; here we just need to avoid mutating the index, no?
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.
isnt that what deep=False
means?
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.
oh woa, yes, i would remove the param then, its confusing
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.
if you can remove here and above the deep keyword
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 prefer to be explicit about this being non-deep
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.
would prefer to just use copy, this is not the pattern we use; your comment is explanatory.
also i think this needs a whatsnew bug fix reshaping note |
whatsnew added + green |
pandas/core/generic.py
Outdated
@@ -8835,6 +8839,10 @@ def _align_series( | |||
if is_datetime64tz_dtype(left.index.dtype): | |||
if left.index.tz != right.index.tz: | |||
if join_index is not None: | |||
# GH#33671 ensure we don't change the index on | |||
# our original Series | |||
left = left.copy(deep=False) |
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.
if you can remove here and above the deep keyword
pandas/core/generic.py
Outdated
@@ -8835,6 +8839,10 @@ def _align_series( | |||
if is_datetime64tz_dtype(left.index.dtype): | |||
if left.index.tz != right.index.tz: | |||
if join_index is not None: | |||
# GH#33671 ensure we don't change the index on | |||
# our original Series | |||
left = left.copy(deep=False) |
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.
would prefer to just use copy, this is not the pattern we use; your comment is explanatory.
updated + greenasitgets |
* BUG: alignment changing index on input series * whatsnew * remove deep=False
black pandas
git diff upstream/master -u -- "*.py" | flake8 --diff