Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOC: Update pandas.core.groupby.GroupBy.pipe docstring #32531

Closed
wants to merge 10 commits into from
21 changes: 11 additions & 10 deletions pandas/core/groupby/groupby.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,14 +190,14 @@ class providing the base-class of operations.
)

_pipe_template = """
Apply a function `func` with arguments to this %(klass)s object and return
the function's result.
Apply a function `func` with arguments to this %(klass)s object and return the result.

%(versionadded)s

Instead of writing:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you restore this? I think it made more sense where it was. Looks out of context here.

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)

Expand All @@ -212,19 +212,20 @@ class providing the base-class of operations.

Parameters
----------
func : callable or tuple of (callable, string)
Function to apply to this %(klass)s object or, alternatively,
func : callable or tuple of (callable, str)
Function to apply to this %(klass)s object or
a `(callable, data_keyword)` tuple where `data_keyword` is a
string indicating the keyword of `callable` that expects the
%(klass)s object.
args : iterable, optional
Positional arguments passed into `func`.
kwargs : dict, optional
A dictionary of keyword arguments passed into `func`.
*args : iterable, optional
Positional arguments passed into `func`.
**kwargs : dict, optional
A dictionary of keyword arguments passed into `func`.

Returns
-------
object : the return type of `func`.
object
The return type of `func`.

See Also
--------
Expand Down