Skip to content
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

DOC: Fix #24268 by updating description for keep in Series.nlargest #25358

Merged
merged 11 commits into from
Mar 5, 2019
20 changes: 15 additions & 5 deletions pandas/core/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -3098,11 +3098,16 @@ def nlargest(self, n=5, keep='first'):
When there are duplicate values that cannot all fit in a
Series of `n` elements:

- ``first`` : take the first occurrences based on the index order
- ``last`` : take the last occurrences based on the index order
- ``first`` : return the first `n` occurrences in order
of appearance.
- ``last`` : return the last `n` occurrences in reverse
order of appearance.
- ``all`` : keep all occurrences. This can result in a Series of
size larger than `n`.

Regardless of `keep`, the result will be sorted
bharatr21 marked this conversation as resolved.
Show resolved Hide resolved
by the row label.

Returns
-------
Series
Expand Down Expand Up @@ -3194,11 +3199,16 @@ def nsmallest(self, n=5, keep='first'):
When there are duplicate values that cannot all fit in a
Series of `n` elements:

- ``first`` : take the first occurrences based on the index order
- ``last`` : take the last occurrences based on the index order
- ``first`` : return the first `n` occurrences in order
of appearance.
- ``last`` : return the last `n` occurrences in reverse
order of appearance.
- ``all`` : keep all occurrences. This can result in a Series of
size larger than `n`.

Regardless of `keep`, the result will be sorted
by the row label.

Returns
-------
Series
Expand Down Expand Up @@ -3236,7 +3246,7 @@ def nsmallest(self, n=5, keep='first'):
Monserat 5200
dtype: int64

The `n` largest elements where ``n=5`` by default.
The `n` smallest elements where ``n=5`` by default.
bharatr21 marked this conversation as resolved.
Show resolved Hide resolved

>>> s.nsmallest()
Monserat 5200
Expand Down