Skip to content

Commit bb7eebb

Browse files
committed
improve doc string for df.aggregate and df.transform
1 parent 996f361 commit bb7eebb

File tree

1 file changed

+24
-12
lines changed

1 file changed

+24
-12
lines changed

pandas/core/generic.py

+24-12
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@
6363
_shared_docs = dict()
6464
_shared_doc_kwargs = dict(
6565
axes='keywords for axes', klass='NDFrame',
66+
axis="""
67+
axis : {0 or 'index', 1 or 'columns'}, default 0
68+
- 0 or 'index': apply function to each column.
69+
- 1 or 'columns': apply function to each row.""",
6670
axes_single_arg='int or labels for object',
6771
args_transpose='axes to permute (int or label for object)',
6872
optional_by="""
@@ -4545,17 +4549,16 @@ def pipe(self, func, *args, **kwargs):
45454549
45464550
Parameters
45474551
----------
4548-
func : function, string, dictionary, or list of string/functions
4552+
func : function, string, list of string/functions or dictionary
45494553
Function to use for aggregating the data. If a function, must either
4550-
work when passed a %(klass)s or when passed to %(klass)s.apply. For
4551-
a DataFrame, can pass a dict, if the keys are DataFrame column names.
4554+
work when passed a %(klass)s or when passed to %(klass)s.apply.
45524555
45534556
Accepted combinations are:
45544557
4555-
- string function name.
4556-
- function.
4557-
- list of functions.
4558-
- dict of column names -> functions (or list of functions).
4558+
- string function name
4559+
- function
4560+
- list of functions and/or function names
4561+
- dict of axis labels -> functions, function names and/or list of such
45594562
%(axis)s
45604563
*args
45614564
Positional arguments to pass to `func`.
@@ -4581,15 +4584,24 @@ def pipe(self, func, *args, **kwargs):
45814584
45824585
Parameters
45834586
----------
4584-
func : callable, string, dictionary, or list of string/callables
4585-
To apply to column
4587+
func : function, string, list of string/functions or dictionary
4588+
Function to use for transforming the data. If a function, must either
4589+
work when passed a %(klass)s or when passed to %(klass)s.apply.
4590+
The function (or each function in a list/dict) must return an
4591+
object with the same length for the provided axis as the
4592+
calling %(klass)s.
45864593
4587-
Accepted Combinations are:
4594+
Accepted combinations are:
45884595
45894596
- string function name
45904597
- function
4591-
- list of functions
4592-
- dict of column names -> functions (or list of functions)
4598+
- list of functions and/or function names
4599+
- dict of axis labels -> functions, function names and/or list of such
4600+
%(axis)s
4601+
*args
4602+
Positional arguments to pass to `func`.
4603+
**kwargs
4604+
Keyword arguments to pass to `func`.
45934605
45944606
Returns
45954607
-------

0 commit comments

Comments
 (0)