-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
BUG: DataFrameGroupBy.transform with axis=1 fails (#36308) #36350
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
Thanks @ethanator, can you also add a test and bug fix note in the v1.1.3 whatsnew? |
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.
put this on 1.2, pls add a test for shift and for pct_change which was modified as well.
@ethanator Are you still interested in working on this? |
Yes. I got distracted but I'm adding tests now to wrap this up. |
This pull request is stale because it has been open for thirty days with no activity. Please update or respond to this comment if you're still interested in working on this. |
@ethanator I'd like to get this in 1.2, would it be okay if I finished it up? |
yes, if you can address comments about tests and merge master this looked almost ready |
Both |
Test fails on Windows 32-bit because DataFrame gets constructed with 32-bit ints but doing |
Well which is the "correct" answer? if you want to get int32 when on a 32bit machine you can do
|
Thanks @jbrockmendel, that's exactly what I was asking but it turns out I had it backwards. The result in the test was 64-bit, but using However, I'm not sure if this is really the correct behavior. Should the result be coming back as 64-bit here as is currently the case? |
your inputs are all int64 (on windows as well), so it IS suprising that you are getting an intp back (32-bit on windows). though i suppose somewhere we are constructing a return array for the ints that uses intp. I would say ok for now, but let's open an issue to dig depper on this. @rhshadrach ok on this otherwise? (lgtm.). |
Aside from this, the PR is good on my end. |
|
||
if transformation_func == "diff": | ||
# Result contains nans, so transpose coerces to float | ||
expected["b"] = expected["b"].astype("int64") |
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.
oh i c you are doing this because we want to compare to ints, got it ,then this is fine.
thanks @ethanator |
black pandas
git diff upstream/master -u -- "*.py" | flake8 --diff
Updated
pandas.core.groupby.generic._wrap_transformed_output
as suggested by @rhshadrach but also had to modifypandas.core.groupby.groupby.pct_change
to get 2 tests passed where the operation passed totransform
ispct_change
.All tests passed except for
pandas/tests/io/test_clipboard.py
andpandas/tests/io/test_parquet.py
that are already broken on the latestmaster
as of September 14, 2020 01:15 UTC.