Skip to content

Commit

Permalink
Typing: Narrow down types of argument keep for nsmallest and nlargest (
Browse files Browse the repository at this point in the history
…pandas-dev#52753)

* Typing: Narrow down types of argument keep for nsmallest and nlargest

* fixed formatting with black
  • Loading branch information
mattkeanny authored Apr 20, 2023
1 parent 065b3d0 commit 75435a7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pandas/core/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -3901,7 +3901,9 @@ def nlargest(
"""
return selectn.SelectNSeries(self, n=n, keep=keep).nlargest()

def nsmallest(self, n: int = 5, keep: str = "first") -> Series:
def nsmallest(
self, n: int = 5, keep: Literal["first", "last", "all"] = "first"
) -> Series:
"""
Return the smallest `n` elements.
Expand Down

0 comments on commit 75435a7

Please sign in to comment.