Skip to content
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

Merged

Conversation

OlivierCavadenti
Copy link
Contributor

@@ -1327,6 +1327,16 @@ def func(ser):
tm.assert_frame_equal(res, expected)


def test_groupby_aggregate_directory():
Copy link
Contributor

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

Copy link
Contributor Author

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).

@jreback jreback added Dtype Conversions Unexpected or buggy dtype conversions Groupby Testing pandas testing functions or related to the test suite labels Oct 7, 2021
pandas/tests/groupby/aggregate/test_aggregate.py Outdated Show resolved Hide resolved
pandas/tests/groupby/aggregate/test_aggregate.py Outdated Show resolved Hide resolved
@OlivierCavadenti
Copy link
Contributor Author

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.

Copy link
Contributor

@jreback jreback left a 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"]:
Copy link
Contributor

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()
Copy link
Contributor

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?

@jreback jreback added this to the 1.4 milestone Oct 29, 2021
@jreback jreback merged commit 7bf75b0 into pandas-dev:master Oct 29, 2021
@jreback
Copy link
Contributor

jreback commented Oct 29, 2021

thanks @OlivierCavadenti

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Dtype Conversions Unexpected or buggy dtype conversions Groupby Testing pandas testing functions or related to the test suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Aggregation does not preserve dtype when function passed in dictionary
2 participants