pandas.api.typing.SeriesGroupBy.nsmallest
pandas 3.1.1 · GroupBy · method
Get the n smallest observations.
Call syntax
pd.api.typing.SeriesGroupBy.nsmallest(n=5, keep='first')Run the example
Edit the example and select Run Python to see the result.
Parameters
| Parameter | Requirement | Accepted values and behavior |
|---|---|---|
n |
Optional Positional or keyword Default 5 |
int Choose how many entries or positions to use. |
keep |
Optional Positional or keyword Default 'first' |
{'first', 'last', 'all'} Choose which occurrence to retain when values are duplicated or tied. |
Returns
Series