pandas.core.groupby.GroupBy.pipe

Apply a function func with arguments to this GroupBy object and return the function’s result.

New in version 0.21.0.

Use .pipe when you want to improve readability by chaining together functions that expect Series, DataFrames, GroupBy or Resampler objects. Instead of writing

>>> h(g(f(df.groupby('group')), arg1=a), arg2=b, arg3=c)

You can write

>>> (df.groupby('group')
...    .pipe(f)
...    .pipe(g, arg1=a)
...    .pipe(h, arg2=b, arg3=c))

which is much more readable.

param func
callable or tuple of (callable, string)

Function to apply to this GroupBy object or, alternatively, a (callable, data_keyword) tuple where data_keyword is a string indicating the keyword of callable that expects the GroupBy object.

param args
iterable, optional

positional arguments passed into func.

param kwargs
dict, optional

a dictionary of keyword arguments passed into func.

return

object : the return type of func.

Warning

This feature is currently unsupported by Intel Scalable Dataframe Compiler