Skip to content

Commit 076b5a8

Browse files
bharatr21TomAugspurger
authored andcommitted
DOC: Fix #24268 by updating description for keep in Series.nlargest (#25358)
* DOC: Fix #24268 by updating description for keep
1 parent 3bbcacf commit 076b5a8

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

Diff for: pandas/core/series.py

+9-5
Original file line numberDiff line numberDiff line change
@@ -3098,8 +3098,10 @@ def nlargest(self, n=5, keep='first'):
30983098
When there are duplicate values that cannot all fit in a
30993099
Series of `n` elements:
31003100
3101-
- ``first`` : take the first occurrences based on the index order
3102-
- ``last`` : take the last occurrences based on the index order
3101+
- ``first`` : return the first `n` occurrences in order
3102+
of appearance.
3103+
- ``last`` : return the last `n` occurrences in reverse
3104+
order of appearance.
31033105
- ``all`` : keep all occurrences. This can result in a Series of
31043106
size larger than `n`.
31053107
@@ -3194,8 +3196,10 @@ def nsmallest(self, n=5, keep='first'):
31943196
When there are duplicate values that cannot all fit in a
31953197
Series of `n` elements:
31963198
3197-
- ``first`` : take the first occurrences based on the index order
3198-
- ``last`` : take the last occurrences based on the index order
3199+
- ``first`` : return the first `n` occurrences in order
3200+
of appearance.
3201+
- ``last`` : return the last `n` occurrences in reverse
3202+
order of appearance.
31993203
- ``all`` : keep all occurrences. This can result in a Series of
32003204
size larger than `n`.
32013205
@@ -3236,7 +3240,7 @@ def nsmallest(self, n=5, keep='first'):
32363240
Monserat 5200
32373241
dtype: int64
32383242
3239-
The `n` largest elements where ``n=5`` by default.
3243+
The `n` smallest elements where ``n=5`` by default.
32403244
32413245
>>> s.nsmallest()
32423246
Monserat 5200

0 commit comments

Comments
 (0)