-
-
Notifications
You must be signed in to change notification settings - Fork 19.4k
Closed
Labels
Milestone
Description
The following seems to happen on all transform groupby kernels:
df = DataFrame({"A": [1, 2, 3], "B": [4, 5, 6]})
df.groupby([1, 1], axis=1).transform("shift")
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 account self.axis when wrapping the output. All that needs to happen is result = result.T and to use the index labels rather than the column labels for columns there.