-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: nlargest/nsmallest can now consider nan values like sort_values(ascending=True).head(n) #43060
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 22 commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
3451902
Update test_to_datetime.py
usersblock 6c3a339
Merge branch 'pandas-dev:master' into master
usersblock 1b52822
Update test_to_datetime.py
usersblock 493b70d
Merge branch 'master' of https://github.com/usersblock/pandas
usersblock 59d4145
Update test_to_datetime.py
usersblock 763d84c
Update test_to_datetime.py
usersblock 1404f7a
Update test_to_datetime.py
usersblock c649998
Update test_to_datetime.py
usersblock 44645d7
Update test_to_datetime.py
usersblock e3cb80c
Update test_to_datetime.py
usersblock 970ed06
Update test_to_datetime.py
usersblock 4571bd6
Merge branch 'pandas-dev:master' into master
usersblock d57f608
Merge branch 'pandas-dev:master' into master
usersblock e6edb59
Merge branch 'pandas-dev:master' into master
usersblock 71be209
Updated Test and fixed nlargest
usersblock c5c751c
Update algorithms.py
usersblock a00fb9e
Update algorithms.py
usersblock 6e5c7b0
Update algorithms.py
usersblock a1a9d06
Update test_nlargest.py
usersblock 491d077
Update test_nlargest.py
usersblock 8708cc0
Update test_nlargest.py
usersblock a5cb642
Update test_nlargest.py
usersblock 7d2aac4
Updated test_nlargest and docs
usersblock 2d0931f
Update v1.4.0.rst
usersblock ca3af24
Update test_apply.py
usersblock 80d4fcb
Update test_apply.py
usersblock 5717466
Update algorithms.py
usersblock 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 |
---|---|---|
|
@@ -127,8 +127,8 @@ def test_nsmallest_nlargest(self, s_main_dtypes_split): | |
def test_nlargest_misc(self): | ||
|
||
ser = Series([3.0, np.nan, 1, 2, 5]) | ||
tm.assert_series_equal(ser.nlargest(), ser.iloc[[4, 0, 3, 2]]) | ||
tm.assert_series_equal(ser.nsmallest(), ser.iloc[[2, 3, 0, 4]]) | ||
tm.assert_series_equal(ser.nlargest(), ser.iloc[[4, 0, 3, 2, 1]]) | ||
tm.assert_series_equal(ser.nsmallest(), ser.iloc[[2, 3, 0, 4, 1]]) | ||
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. can you rewrite this test using 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. Added result/expected and added entry into the doc |
||
|
||
msg = 'keep must be either "first", "last"' | ||
with pytest.raises(ValueError, match=msg): | ||
|
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dont' you need to use .iloc here? as this will not be a positional lookup (it might work with a range index though)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be done now