-
-
Notifications
You must be signed in to change notification settings - Fork 18.8k
API: ExtensionArray.argsort places the missing value at the end #27137
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
Merged
Merged
Changes from 2 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
0b3d22d
Use nargsort inside EA.argsort to sort
makbigc 79df1d8
Add benchmark
makbigc 01e3686
Merge remote-tracking branch 'upstream/master' into makbigc-enh-21801-2
TomAugspurger a5d46ce
Updates
TomAugspurger b1b96a7
API: break Categorical.argsort
TomAugspurger c5bfb44
issue
TomAugspurger c9868c1
update for break
TomAugspurger 7bedc4b
update for break
TomAugspurger 6b1871c
Merge remote-tracking branch 'upstream/master' into makbigc-enh-21801-2
TomAugspurger c917575
trigger CI
TomAugspurger bd2cbfd
32-bit compat
TomAugspurger 47c6b57
32-bit compat
TomAugspurger File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,6 +23,7 @@ | |
|
||
from pandas._typing import ArrayLike | ||
from pandas.core import ops | ||
from pandas.core.sorting import nargsort | ||
|
||
_not_implemented_message = "{} does not implement {}." | ||
|
||
|
@@ -398,7 +399,8 @@ def argsort(self, ascending=True, kind='quicksort', *args, **kwargs): | |
Returns | ||
------- | ||
index_array : ndarray | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. so we aren't specific that these are actually intp (and NOT int64's) |
||
Array of indices that sort ``self``. | ||
Array of indices that sort ``self``. If NaN values are contained, | ||
NaN values are placed at the end. | ||
|
||
See Also | ||
-------- | ||
|
@@ -409,10 +411,9 @@ def argsort(self, ascending=True, kind='quicksort', *args, **kwargs): | |
# 1. _values_for_argsort : construct the values passed to np.argsort | ||
# 2. argsort : total control over sorting. | ||
ascending = nv.validate_argsort_with_ascending(ascending, args, kwargs) | ||
values = self._values_for_argsort() | ||
result = np.argsort(values, kind=kind, **kwargs) | ||
if not ascending: | ||
result = result[::-1] | ||
|
||
result = nargsort(self, kind=kind, ascending=ascending, | ||
na_position='last') | ||
return result | ||
|
||
def fillna(self, value=None, method=None, limit=None): | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.