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.apply  #

SeriesGroupBy.  apply  (  _ func  _ , _ *  args  _ , _ **  kwargs  _ )  [
[source]  ](https://github.com/pandas-
dev/pandas/blob/v2.2.2/pandas/core/groupby/generic.py#L224-L230) #

    

Apply function ` func  ` group-wise and combine the results together.

The function passed to ` apply  ` must take a series as its first argument and
return a DataFrame, Series or scalar. ` apply  ` will then take care of
combining the results back together into a single dataframe or series. ` apply
` is therefore a highly flexible grouping method.

While ` apply  ` is a very flexible method, its downside is that using it can
be quite a bit slower than using more specific methods like ` agg  ` or `
transform  ` . Pandas offers a wide range of method that will be much faster
than using ` apply  ` for their specific purposes, so try to use them before
reaching for ` apply  ` .

Parameters  :

    

**func** callable

    

A callable that takes a series as its first argument, and returns a dataframe,
a series or a scalar. In addition the callable may take positional and keyword
arguments.

**include_groups** bool, default True

    

When True, will attempt to apply ` func  ` to the groupings in the case that
they are columns of the DataFrame. If this raises a TypeError, the result will
be computed with the groupings excluded. When False, the groupings will be
excluded when applying ` func  ` .

New in version 2.2.0.

Deprecated since version 2.2.0:  Setting include_groups to True is deprecated.
Only the value False will be allowed in a future version of pandas.

**args, kwargs** tuple and dict

    

Optional positional and keyword arguments to pass to ` func  ` .

Returns  :

    

Series or DataFrame

    

See also

[ ` pipe  `
](pandas.core.groupby.SeriesGroupBy.pipe.html#pandas.core.groupby.SeriesGroupBy.pipe
"pandas.core.groupby.SeriesGroupBy.pipe")

    

Apply function to the full GroupBy object instead of to each grou