Skip to content

Commit 75435a7

Browse files
authored
Typing: Narrow down types of argument keep for nsmallest and nlargest (#52753)
* Typing: Narrow down types of argument keep for nsmallest and nlargest * fixed formatting with black
1 parent 065b3d0 commit 75435a7

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pandas/core/series.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -3901,7 +3901,9 @@ def nlargest(
39013901
"""
39023902
return selectn.SelectNSeries(self, n=n, keep=keep).nlargest()
39033903

3904-
def nsmallest(self, n: int = 5, keep: str = "first") -> Series:
3904+
def nsmallest(
3905+
self, n: int = 5, keep: Literal["first", "last", "all"] = "first"
3906+
) -> Series:
39053907
"""
39063908
Return the smallest `n` elements.
39073909

0 commit comments

Comments
 (0)