e.groupby.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.nth  #

_ property  _ SeriesGroupBy.  nth  [ [source]  ](https://github.com/pandas-
dev/pandas/blob/v2.2.2/pandas/core/groupby/groupby.py#L4185-L4277) #

    

Take the nth row from each group if n is an int, otherwise a subset of rows.

Can be either a call or an index. dropna is not available with index notation.
Index notation accepts a comma separated list of integers and slices.

If dropna, will take the nth non-null row, dropna is either âallâ or
âanyâ; this is equivalent to calling dropna(how=dropna) before the
groupby.

Parameters  :

    

**n** int, slice or list of ints and slices

    

A single nth value for the row or a list of nth values or slices.

Changed in version 1.4.0:  Added slice and lists containing slices. Added
index notation.

**dropna** {âanyâ, âallâ, None}, default None

    

Apply the specified dropna operation before counting which row is the nth row.
Only supported if n is an int.

Returns  :

    

Series or DataFrame

    

N-th value within each group.

See also

` Series.groupby  `

    

Apply a function groupby to a Series.

` DataFrame.groupby  `

    

Apply a function groupby to each row or column of a DataFrame.

Examples

    
    
    >>> df = pd.DataFrame({'A': [1, 1, 2, 1, 2],
    ...                    'B': [np.nan, 2, 3, 4, 5]}, columns=['A', 'B'])
    >>> g = df.groupby('A')
    >>> g.nth(0)
       A   B
    0  1 NaN
    2  2 3.0
    >>> g.nth(1)
       A   B
    1  1 2.0
    4  2 5.0
    >>> g.nth(-1)
       A   B
    3  1 4.0
    4  2 5.0
    >>> g.nth([0, 1])
       A   B
    0  1 NaN
    1  1 2.0
    2  2 3.0
    4  2 5.0
    >>> g.nth(slice(None, -1))
       A   B
    0  1 NaN
    1  1 2.0
    2  2 3.0
    

Index notation may also be used

    
    
    >>> g.nth[0, 1]
       A   B
    0  1 NaN
    1  1 2.0
    2  2 3.0
    4  2 5.0
    >>> g.nth[:-1]
       A   B
    0  1 NaN
    1  1 2.0
    2  2 3.0
    

Specifying  dropna  allows ignoring `