You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Groupby.apply on a specific column does not return correct keys in the output, despite the value column being return in the original order with correct results.
Closes#8898
Originally, when returning a Series from a `GroupBy.apply()` operation, we would pass in `self.grouping.keys[offsets[:-1]]` as the index, which was meant to grab each unique group key, assuming that `self.grouping.keys` is sorted. However, because it is not sorted, this just ends up grabbing 5 group keys at random.
Since we are already calling `GroupBy._grouped()` in this operation, we can use the `group_names` returned by that as the index instead, which is what the result of `self.grouping.keys[offsets[:-1]]` would be if `self.grouping.keys` was sorted.
Authors:
- Charles Blackmon-Luca (https://github.com/charlesbluca)
Approvers:
- Michael Wang (https://github.com/isVoid)
URL: #9016
Groupby.apply on a specific column does not return correct keys in the output, despite the value column being return in the original order with correct results.
We'd expect to see every key once in the output, but do not.
The text was updated successfully, but these errors were encountered: