-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: GH15426 timezone lost in groupby-agg with cython functions #15433
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: GH15426 timezone lost in groupby-agg with cython functions #15433
Conversation
Codecov Report
@@ Coverage Diff @@
## master #15433 +/- ##
==========================================
+ Coverage 90.36% 90.37% +<.01%
==========================================
Files 136 136
Lines 49553 49554 +1
==========================================
+ Hits 44780 44782 +2
+ Misses 4773 4772 -1
Continue to review full report at Codecov.
|
@@ -738,3 +738,14 @@ def test_agg_over_numpy_arrays(self): | |||
columns=expected_column) | |||
|
|||
assert_frame_equal(result, expected) | |||
|
|||
def test_agg_time_zone_round_trip(self): | |||
ts = pd.Timestamp("2016-01-01 12:00:00", tz='US/Pacific') |
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.
add the issue number as a comment
df = pd.DataFrame({'a': 1, 'b': [ts + timedelta(minutes=nn) | ||
for nn in range(10)]}) | ||
|
||
result1 = df.groupby('a')['b'].agg(np.min).iloc[0] |
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.
compare with .min()
as well
@@ -133,7 +133,8 @@ def trans(x): # noqa | |||
if dtype.tz: | |||
# convert to datetime and change timezone | |||
from pandas import to_datetime | |||
result = to_datetime(result).tz_localize(dtype.tz) | |||
result = to_datetime(result).tz_localize('utc') |
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 add addtl tests in pandas/tests/types/test_cast.py
fit them in as appropriate. take out this fix temporarily to validate your test cases, then add back to make sure they work.
add examples from #10668 as well. (and you can list list issue in the whatsnew too) |
can you update |
ae0ea81
to
64a84ca
Compare
thanks! |
closes pandas-dev#15426 Author: Stephen Rauch <[email protected]> Closes pandas-dev#15433 from stephenrauch/tz-lost-in-groupby-agg and squashes the following commits: 64a84ca [Stephen Rauch] BUG: GH15426 timezone lost in groupby-agg with cython functions
git diff upstream/master | flake8 --diff