ueshin opened a new pull request, #54352:
URL: https://github.com/apache/spark/pull/54352
### What changes were proposed in this pull request?
This is a follow-up of apache/spark#54276.
Fixes `groupby(as_index=False).apply` with dict.
### Why are the changes needed?
The case of `groupby(as_index=False).apply` with dict was missing at
apache/spark#54276.
```py
>>> psdf = ps.DataFrame(
... {"A": [1, 1, 2, 2], "B": [1, 2, 3, 4], "C": [0.362, 0.227, 1.267,
-0.562]}
... )
>>> psdf.groupby(psdf.A, as_index=False).agg({"B": "min", "C": "sum"})
A B C
0 1 1 0.589
1 2 3 0.705
>>>
>>> psdf.groupby(psdf.A + 1, as_index=False).agg({"B": "min", "C": "sum"})
B C
0 1 0.589
1 3 0.705
```
whereas pandas 3:
```py
>>> pdf = pd.DataFrame(
... {"A": [1, 1, 2, 2], "B": [1, 2, 3, 4], "C": [0.362, 0.227, 1.267,
-0.562]}
... )
>>> pdf.groupby(pdf.A, as_index=False).agg({"B": "min", "C": "sum"})
A B C
0 1 1 0.589
1 2 3 0.705
>>>
>>> pdf.groupby(pdf.A + 1, as_index=False).agg({"B": "min", "C": "sum"})
A B C
0 2 1 0.589
1 3 3 0.705
```
### Does this PR introduce _any_ user-facing change?
Yes, it will behave more like pandas 3.
### How was this patch tested?
The existing tests should pass.
### Was this patch authored or co-authored using generative AI tooling?
Codex (GPT-5.3-Codex)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]