pby.SeriesGroupBy.rolling ](pandas.core.groupby.SeriesGroupBy.rolling.html)
    * [ pandas.core.groupby.SeriesGroupBy.sample ](pandas.core.groupby.SeriesGroupBy.sample.html)
    * [ pandas.core.groupby.SeriesGroupBy.sem ](pandas.core.groupby.SeriesGroupBy.sem.html)
    * [ pandas.core.groupby.SeriesGroupBy.shift ](pandas.core.groupby.SeriesGroupBy.shift.html)
    * [ pandas.core.groupby.SeriesGroupBy.size ](pandas.core.groupby.SeriesGroupBy.size.html)
    * [ pandas.core.groupby.SeriesGroupBy.skew ](pandas.core.groupby.SeriesGroupBy.skew.html)
    * [ pandas.core.groupby.SeriesGroupBy.std ](pandas.core.groupby.SeriesGroupBy.std.html)
    * [ pandas.core.groupby.SeriesGroupBy.sum ](pandas.core.groupby.SeriesGroupBy.sum.html)
    * [ pandas.core.groupby.SeriesGroupBy.var ](pandas.core.groupby.SeriesGroupBy.var.html)
    * [ pandas.core.groupby.SeriesGroupBy.tail ](pandas.core.groupby.SeriesGroupBy.tail.html)
    * [ pandas.core.groupby.SeriesGroupBy.take ](pandas.core.groupby.SeriesGroupBy.take.html)
    * [ pandas.core.groupby.SeriesGroupBy.value_counts ](pandas.core.groupby.SeriesGroupBy.value_counts.html)
    * [ pandas.core.groupby.DataFrameGroupBy.boxplot ](pandas.core.groupby.DataFrameGroupBy.boxplot.html)
    * [ pandas.core.groupby.DataFrameGroupBy.hist ](pandas.core.groupby.DataFrameGroupBy.hist.html)
    * [ pandas.core.groupby.SeriesGroupBy.hist ](pandas.core.groupby.SeriesGroupBy.hist.html)
    * [ pandas.core.groupby.DataFrameGroupBy.plot ](pandas.core.groupby.DataFrameGroupBy.plot.html)
    * [ pandas.core.groupby.SeriesGroupBy.plot ](pandas.core.groupby.SeriesGroupBy.plot.html)
  * [ Resampling ](../resampling.html)
  * [ Style ](../style.html)
  * [ Plotting ](../plotting.html)
  * [ Options and settings ](../options.html)
  * [ Extensions ](../extensions.html)
  * [ Testing ](../testing.html)
  * [ Missing values ](../missing_value.html)

  * [ __ ](../../index.html)
  * [ API reference ](../index.html)
  * [ GroupBy ](../groupby.html)
  * pandas.core.... 

#  pandas.core.groupby.SeriesGroupBy.nsmallest  #

SeriesGroupBy.  nsmallest  (  _ n  =  5  _ , _ keep  =  'first'  _ )  [
[source]  ](https://github.com/pandas-
dev/pandas/blob/v2.2.2/pandas/core/groupby/generic.py#L1165-L1174) #

    

Return the smallest  n  elements.

Parameters  :

    

**n** int, default 5

    

Return this many ascending sorted values.

**keep** {âfirstâ, âlastâ, âallâ}, default âfirstâ

    

When there are duplicate values that cannot all fit in a Series of  n
elements:

  * ` 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  . 

Returns  :

    

Series

    

The  n  smallest values in the Series, sorted in increasing order.

See also

` Series.nlargest  `

    

Get the  n  largest elements.

` Series.sort_values  `

    

Sort Series by values.

` Series.head  `

    

Return the first  n  rows.

Notes

Faster than ` .sort_values().head(n)  ` for small  n  relative to the size of
the ` Series  ` object.

Examples

    
    
    >>> countries_population = {"Italy": 59000000, "France": 65000000,
    ...                         "Brunei": 434000, "Malta": 434000,
    ...                         "Maldives": 434000, "Iceland": 337000,
    ...                         "Nauru": 11300, "Tuvalu": 11300,
    ...                         "Anguilla": 11300, "Montserrat": 5200}
    >>> s = pd.Series(countries_population)
    >>> s
    Italy       59000000
    France      65000000
    Brunei        434000
    Malta         434000
    Maldives      434000
    Iceland       337000
    Nauru          11300
    Tuvalu         11300
    Anguilla       11300
    Montserrat      5200
    dtype: int64
    

The  n  smallest elements where ` n=5  ` by default.

    
    
    >>> s.nsmallest()
    Montserrat    5200
    Nauru        11300
    Tuvalu