Skip to content

TST: Determine groupby-transform not convert back type #50754

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

Conversation

luke396
Copy link
Contributor

@luke396 luke396 commented Jan 15, 2023

result = df.groupby("a")["val"].transform(lambda x: f"+{x}").dtype
original = df["val"].dtype
expected = df["val"].transform(lambda x: f"+{x}").dtype
assert result != original
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check the whole DataFrame

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does it look this time?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you test all cases from the issue?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that what you mean, I'm not quite sure I fully understand what you mean.

Does this direct listing of result and excepted need to be further optimized?

@mroeschke mroeschke added Testing pandas testing functions or related to the test suite Groupby Apply Apply, Aggregate, Transform, Map labels Jan 16, 2023
@mroeschke mroeschke added this to the 2.0 milestone Jan 17, 2023
@mroeschke mroeschke merged commit ef4cf72 into pandas-dev:main Jan 17, 2023
@mroeschke
Copy link
Member

Thanks @luke396

@luke396 luke396 deleted the determine-groupby-transform-not-convert-back-type branch January 18, 2023 13:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Apply Apply, Aggregate, Transform, Map Groupby Testing pandas testing functions or related to the test suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DataFrame.groupby()[col].transform() tries to convert result to original column type
3 participants