-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: Preserve subclassing with groupby operations #28573
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
Changes from all commits
6393668
d74136b
d1f8d63
3fab1ff
5af4209
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 |
---|---|---|
|
@@ -134,6 +134,23 @@ def func(dataf): | |
result = df.groupby("X", squeeze=False).count() | ||
assert isinstance(result, DataFrame) | ||
|
||
# https://github.com/pandas-dev/pandas/issues/28330 | ||
# Test groupby operations on subclassed dataframes/series | ||
|
||
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. actually these tests are different that the above ones, can you make a new test |
||
cdf = tm.SubclassedDataFrame( | ||
[ | ||
{"val1": 1, "val2": 20}, | ||
{"val1": 1, "val2": 19}, | ||
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. also pls parameterize over as many functions that you can here 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. You can use |
||
{"val1": 2, "val2": 27}, | ||
{"val1": 2, "val2": 12}, | ||
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. can you update to comments here |
||
] | ||
) | ||
result = cdf.groupby("val1").sum() | ||
assert isinstance(result, tm.SubclassedDataFrame) | ||
assert isinstance(result, DataFrame) | ||
assert isinstance(result["val2"], tm.SubclassedSeries) | ||
assert isinstance(result["val2"], Series) | ||
|
||
|
||
def test_inconsistent_return_type(): | ||
# GH5592 | ||
|
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.
ideally we split these into several tests, but could be a followup