Skip to content
Next Next commit
docstring groupby.apply initial commit
  • Loading branch information
ajdyka committed Mar 10, 2018
commit 5bffa504cc887987fc4b49c50cd2e7fe1ead135b
12 changes: 7 additions & 5 deletions pandas/core/groupby.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,11 @@
func : function
A callable that takes a {input} as its first argument, and
returns a dataframe, a series or a scalar. In addition the
callable may take positional and keyword arguments
args, kwargs : tuple and dict
Optional positional and keyword arguments to pass to ``func``
callable may take positional and keyword arguments.
args : tuple
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 make this *args ? (and you can leave out the 'tuple')

Optional positional and keyword arguments to pass to ``func``.
Copy link
Member

Choose a reason for hiding this comment

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

This are only the positional ones, and below the keyword ones.

I think it would also be a good idea to add an example of this in the Examples section

kwargs : dict
Copy link
Member

Choose a reason for hiding this comment

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

Here the same **kwargs (and without dict)

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

Returns
-------
Expand Down Expand Up @@ -136,7 +138,7 @@
its argument and returns a dataframe. ``apply`` combines the result for
each group together into a new dataframe:

>>> g.apply(lambda x: x / x.sum())
>>> g[['B','C']].apply(lambda x: x / x.sum())
B C
0 0.333333 0.4
1 0.666667 0.6
Expand All @@ -146,7 +148,7 @@
its argument and returns a series. ``apply`` combines the result for
each group together into a new dataframe:

>>> g.apply(lambda x: x.max() - x.min())
>>> g[['B','C']].apply(lambda x: x.max() - x.min())
B C
A
a 1 2
Expand Down