Skip to content

Commit 34b3222

Browse files
DRudelmroeschkerhshadrach
authored
Revised the doc-string for _app_template to bring in line with curren… (#48613)
* Revised the doc-string for _app_template to bring in line with current aggregate() code, in particular with regard to Named Aggregation. Also fixed text in "See Also" section, where the entries for groupby.transform and aggregate had their text swapped. * Update pandas/core/groupby/groupby.py Co-authored-by: Matthew Roeschke <[email protected]> * fixup * Language tweaks Co-authored-by: Matthew Roeschke <[email protected]> Co-authored-by: MarcoGorelli <> Co-authored-by: Richard Shadrach <[email protected]>
1 parent d3e5e05 commit 34b3222

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

pandas/core/groupby/groupby.py

+11-5
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,7 @@ class providing the base-class of operations.
494494
495495
Parameters
496496
----------
497-
func : function, str, list or dict
497+
func : function, str, list, dict or None
498498
Function to use for aggregating the data. If a function, must either
499499
work when passed a {klass} or when passed to {klass}.apply.
500500
@@ -504,6 +504,10 @@ class providing the base-class of operations.
504504
- string function name
505505
- list of functions and/or function names, e.g. ``[np.sum, 'mean']``
506506
- dict of axis labels -> functions, function names or list of such.
507+
- None, in which case ``**kwargs`` are used with Named Aggregation. Here the
508+
output has one column for each element in ``**kwargs``. The name of the
509+
column is keyword, whereas the value determines the aggregation used to compute
510+
the values in the column.
507511
508512
Can also accept a Numba JIT function with
509513
``engine='numba'`` specified. Only passing a single function is supported
@@ -534,7 +538,9 @@ class providing the base-class of operations.
534538
535539
.. versionadded:: 1.1.0
536540
**kwargs
537-
Keyword arguments to be passed into func.
541+
* If ``func`` is None, ``**kwargs`` are used to define the output names and
542+
aggregations via Named Aggregation. See ``func`` entry.
543+
* Otherwise, keyword arguments to be passed into func.
538544
539545
Returns
540546
-------
@@ -544,10 +550,10 @@ class providing the base-class of operations.
544550
--------
545551
{klass}.groupby.apply : Apply function func group-wise
546552
and combine the results together.
547-
{klass}.groupby.transform : Aggregate using one or more
548-
operations over the specified axis.
549-
{klass}.aggregate : Transforms the Series on each group
553+
{klass}.groupby.transform : Transforms the Series on each group
550554
based on the given function.
555+
{klass}.aggregate : Aggregate using one or more
556+
operations over the specified axis.
551557
552558
Notes
553559
-----

0 commit comments

Comments
 (0)