GroupBy.pipe(func, *args, **kwargs) [source]
Apply a function with arguments to this GroupBy object,
New in version 0.21.0.
| Parameters: |
func : callable or tuple of (callable, string) Function to apply to this GroupBy object or, alternatively, a args : iterable, optional positional arguments passed into kwargs : dict, optional a dictionary of keyword arguments passed into |
|---|---|
| Returns: |
object : the return type of |
See also
pandas.Series.pipe
pandas.DataFrame.pipe
apply
Use .pipe when chaining together functions that expect Series, DataFrames or GroupBy objects. Instead of writing
>>> f(g(h(df.groupby('group')), arg1=a), arg2=b, arg3=c)
You can write
>>> (df
... .groupby('group')
... .pipe(f, arg1)
... .pipe(g, arg2)
... .pipe(h, arg3))
See more here
© 2008–2012, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team
Licensed under the 3-clause BSD License.
http://pandas.pydata.org/pandas-docs/version/0.22.0/generated/pandas.core.groupby.GroupBy.pipe.html