.sort(, descending=True) is not a stable sort
Closed this issue · 2 comments
davidwagner commented
.sort('X')
uses a stable sort: in the case of ties in column X, it preserves the existing order of the rows.
.sort('X', descending=True)
is not a stable sort: in case of ties, it reverses the order of the rows. It appears to be behave as though we did .sort('X')
and then reversed the order of the rows.
This is a bit surprising and counter-intuitive. Is it intentional? Is there an argument for why this behavior is better than the alternative of making descending=True
also use a stable sort?
papajohn commented
Seems like a bug to me. (Probably one that I introduced.)
…On Wed, Sep 23, 2020 at 6:22 PM davidwagner ***@***.***> wrote:
.sort('X') uses a stable sort: in the case of ties in column X, it
preserves the existing order of the rows.
.sort('X', descending=True) is not a stable sort: in case of ties, it
reverses the order of the rows. It appears to be behave as though we did
.sort('X') and then reversed the order of the rows.
This is a bit surprising and counter-intuitive. Is it intentional? Is
there an argument for why this behavior is better than the alternative of
making descending=True also use a stable sort?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#459>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACOFEJPVX4E6CMS5RWTA5LSHKNO5ANCNFSM4RXWHOXQ>
.
hmstepanek commented
I can take a closer look at this.