itholic commented on code in PR #42994:
URL: https://github.com/apache/spark/pull/42994#discussion_r1331072003
##########
python/pyspark/pandas/groupby.py:
##########
@@ -1155,14 +1152,32 @@ def nth(self, n: int) -> FrameLike:
else:
sdf = sdf.select(*groupkey_names).distinct()
- internal = internal.copy(
+ agg_columns = []
+ if not self._agg_columns_selected:
Review Comment:
`groupkeys` is going to be a data column instead of index when it's not
included by `agg_columns_selected`. And index should be kept without updating
from Pandas 2.0.0 for `nth`. Therefore, we should include the `groupkeys` into
agg_columns to make it as a data column and create a new `InternalFrame`
manually.
--
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]