-
-
Notifications
You must be signed in to change notification settings - Fork 18.6k
BUG: Preserve timezone in unaligned assignments #12982
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
BUG: Preserve timezone in unaligned assignments #12982
Conversation
@@ -1940,6 +1940,16 @@ def test_setitem_with_unaligned_sparse_value(self): | |||
exp = pd.Series([1, 0, 0], name='new_column') | |||
assert_series_equal(df['new_column'], exp) | |||
|
|||
def test_setitem_with_unaligned_tz_aware_datetime_column(self): |
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.
can you also test this will .loc
and a mask
e.g.
df.loc[[0,1,2],'dates'] = columns[[1,0,2]]
(should be the same result)
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've addressed comments, and travis checks pass.
@@ -428,3 +428,4 @@ Bug Fixes | |||
|
|||
|
|||
- Bug in ``fill_value`` is ignored if the argument to a binary operator is a constant (:issue `12723`) | |||
- Bug in ``DataFrame._santize_column`` now preserves Timezone when RHS is a Series (:issue `12981`) |
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.
say setting a column with alignment to a Series
that is datetime tz-aware dtype. We don't expect readers to know about internal functions, just the outward effects.
minor changes. ping when green. |
- ``pd.read_excel()`` now accepts column names associated with keyword argument ``names``(:issue:`12870`) | ||
|
||
|
||
- Bug in ``fill_value`` is ignored if the argument to a binary operator is a constant (:issue `12723`) |
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.
Pls remove this.
A fix for GH12981. When doing a slice assign to a DataFrame where the right-hand-side was timezone-aware datetime Series which required realignment to perform the assignment, the timezone would be stripped from the RHS on assignment.
…re_datetime_column GH12981: addressed jreback's comment
40b28c9
to
6689f57
Compare
Current coverage is 83.85%@@ master #12982 diff @@
==========================================
Files 136 136
Lines 49711 49711
Methods 0 0
Messages 0 0
Branches 0 0
==========================================
+ Hits 41679 41683 +4
+ Misses 8032 8028 -4
Partials 0 0
|
thanks! |
git diff upstream/master | flake8 --diff
A fix for #12981. When doing a slice assign to a DataFrame where the
right-hand-side was timezone-aware datetime Series which required
realignment to perform the assignment, the timezone would be stripped
from the RHS on assignment.