-
-
Notifications
You must be signed in to change notification settings - Fork 18k
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: groupby.transform retains timezone information #25264
Changes from 2 commits
4c7e66d
3c5fd19
032e201
a7678a3
ab34a5c
dfe6124
8f808ce
dee41d3
ea016f0
8b6a8e6
6f06d83
288aa07
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 |
---|---|---|
|
@@ -834,3 +834,13 @@ def demean_rename(x): | |
tm.assert_frame_equal(result, expected) | ||
result_single = df.groupby('group').value.transform(demean_rename) | ||
tm.assert_series_equal(result_single, expected['value']) | ||
|
||
|
||
def test_groupby_transform_timezone_column(): | ||
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. Not sure if it's too much here but might be worth creating a fixture for transformation functions and parametrizing based off of that here. That way we could ensure that the tz info doesn't get lost across all instead of just max. 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. Fair point. For this test though, we need reducing functions that are applicable for timestamps though. All that make sense to me is If the list is short, may be worth just parameterizing over directly instead? 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. Yea agreed with your approach. I think it's worth while to start fixturizing these tests to ensure full coverage on particular subsets of algorithms, just don't know what those subsets should all be just yet. I think the way you've done it makes that refactor more apparent in the future if we ever get there |
||
# GH 24198 | ||
ts = pd.to_datetime('now', utc=True).tz_convert('Asia/Singapore') | ||
result = pd.DataFrame({'end_time': [ts], 'id': [1]}) | ||
result['max_end_time'] = result.groupby('id').end_time.transform(max) | ||
expected = pd.DataFrame([[ts, 1, ts]], columns=['end_time', 'id', | ||
'max_end_time']) | ||
tm.assert_frame_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.
ok for 0.24.2