-
Notifications
You must be signed in to change notification settings - Fork 919
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FEA] Stable sort option in sorted_order() #4189
Comments
I'm initially inclined to make these separate APIs rather than a parameter. This would be more inline with |
I thought you (and @harrism) were against increasing API size. Why the change of heart? |
Generally, I'm against unnecessarily increasing the API surface area. As you've demonstrated, having the option for stable sorting is necessary. In this case, adding a new parameter vs. adding a new function has the same effect on the surface area (requires the same number of new tests). Therefore, since surface area isn't a concern, it makes sense in my mind to mirror the STL and Thrust and have separate functions instead of parameters. |
I'm all for necessary API growth, and as Jake points out parameter vs. API is still an increase in testing / documentation / maintenance surface area. What I'm against is unnecessarily having multiple APIs that do the same thing. The sort/stable_sort as separate APIs matches STL and Thrust, and we do aim to have similar naming/terminology to those. |
Is your feature request related to a problem? Please describe.
sorted_order()
usesthrust::sort()
which is not stable. In sort groupby, we need to be able to sort keys in a stable manner so that we can match pandas' behaviour forgroupby.cumsum()
#1298 (comment) andgroupby.nth()
#4172 (comment).Describe the solution you'd like
Add a parameter to
sorted_order()
APIbool stable = false
which can be flipped to usethrust::stable_sort
.The text was updated successfully, but these errors were encountered: