-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
TST : add test for groupby aggregation dtype #43915
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
TST : add test for groupby aggregation dtype #43915
Conversation
OlivierCavadenti
commented
Oct 7, 2021
- closes Aggregation does not preserve dtype when function passed in dictionary #32793
- tests added / passed
- Ensure all linting tests pass, see here for how to run them
- whatsnew entry
@@ -1327,6 +1327,16 @@ def func(ser): | |||
tm.assert_frame_equal(res, expected) | |||
|
|||
|
|||
def test_groupby_aggregate_directory(): |
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 parameterize over of the reduction kernels (use reduction_func
)
and parameterize using frame_or_series
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.
Hi, thanks for the review.
I add reduction_func parameters and I try with frame_or_series parameter but it's seems that using a dictionary on a series for aggregation raise a "nested renamer is not supported" (seems deprecated in #15931 but now raise error).
Say me if I miss something (it's my first contribution).
https://github.com/pandas-dev/pandas/pull/43915/checks?check_run_id=3885731836 fail, I check but I dont understand why in my code impact that. |
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 merge master as well
@@ -1327,6 +1327,27 @@ def func(ser): | |||
tm.assert_frame_equal(res, expected) | |||
|
|||
|
|||
def test_groupby_aggregate_directory(reduction_func): | |||
# GH#32793 | |||
if reduction_func not in ["corrwith", "nth"]: |
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.
just do a return if the reduction_func is in rather than this big if
if reduction_func not in ["corrwith", "nth"]: | ||
obj = DataFrame([[0, 1], [0, np.nan]]) | ||
|
||
obj.convert_dtypes() |
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.
what are you expecting this to do?
thanks @OlivierCavadenti |