Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upBUG: DataFrameGroupBy.transform with axis=1 fails #36308
Comments
Could I work on this issue? |
I tried the same example with : while gives : what output are we expecting here ? |
@Ethanator Absolutely! Simply make a comment here "take" and github will assign it to you. If you encounter any difficulties, feel free to reach out here. @xxsacxx Your 2nd result looks correct to me; the values are shifted 1 to the right, and since there are no values to the left of the first column, you get NaN. The presence of NaN then coerces the dtype to being a float. |
take |
The following seems to happen on all transform groupby kernels:
results in
ValueError: Length mismatch: Expected axis has 2 elements, new values have 3 elements
.I think the issue is in
pandas.core.groupby.generic._wrap_transformed_output
; this method does not take into accountself.axis
when wrapping the output. All that needs to happen isresult = result.T
and to use the index labels rather than the column labels forcolumns
there.