-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
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
ExtensionArray.argsort and nargsort #27218
Comments
My current thinking is that nargsort should dispatch to Of course, that means that EA.argsort will call nargsort on its "values to be sorted". So we should maybe see how this works for the missing values (eg for the EA, only for the non-missing values EA.argsort is called? or do we skip the separation of the values in missing / non-missing as we do for np.argsort for EAs?) |
Is this still relevant now that NumPy has the |
Pushing off 1.0, though this issue is a bit unclear to me now. |
Agreed on both counts. A recent attempt to change nargsort/EA.argsort to work this way broke the world. Have either of you tried doing this? |
@jorisvandenbossche have you looked at this recently? IIUC this is a blocker for #43840. You seem to have the strongest opinions w/r/t to argsort (xref #33941, #33942, #37815) and i don't fully grok them, would probably be made clearer with an implementation. |
nargsort now dispatches to an EA's argsort method, so I think this is closable? |
Yeah it appears this is covered in the EA interface so closing |
47ffcd6 changes how we handle sorting EAs. We've made
nargsort
compatible with extension arrays. It now callsExtensionArray._values_for_argsort
and then applies pandasnargsort
sorting algorithm to the values.This may have broken the (implied) ability for ExtensionArray's to "bring their own" sorting algorithm. For example, you can imagine a GPU-backed EA that has a very fast sorting algorithm available. While
ExtensionArray.argsort
can use that custom sorting algo, pandas may not. Anywhere that usesnargsort(obj)
will now essentially donargsort(thing._values_for_argsort())
for EAs.The text was updated successfully, but these errors were encountered: