Skip to content
20 changes: 15 additions & 5 deletions pandas/core/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -3100,11 +3100,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
by the row label.

Returns
-------
Series
Expand Down Expand Up @@ -3196,11 +3201,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 @@ -3238,7 +3248,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.

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