Skip to content

Commit fc74159

Browse files
committed
fixed doc strings
1 parent a7609e8 commit fc74159

File tree

2 files changed

+48
-42
lines changed

2 files changed

+48
-42
lines changed

pandas/core/frame.py

+9-4
Original file line numberDiff line numberDiff line change
@@ -6880,13 +6880,14 @@ def _gotitem(
68806880
"""
68816881
)
68826882

6883-
@Substitution(
6883+
@doc(
6884+
_shared_docs["aggregate"],
6885+
klass=_shared_doc_kwargs["klass"],
6886+
axis=_shared_doc_kwargs["axis"],
68846887
see_also=_agg_summary_and_see_also_doc,
68856888
examples=_agg_examples_doc,
68866889
versionadded="\n.. versionadded:: 0.20.0\n",
6887-
**_shared_doc_kwargs,
68886890
)
6889-
@Appender(_shared_docs["aggregate"])
68906891
def aggregate(self, func, axis=0, *args, **kwargs):
68916892
axis = self._get_axis_number(axis)
68926893

@@ -6910,7 +6911,11 @@ def _aggregate(self, arg, axis=0, *args, **kwargs):
69106911

69116912
agg = aggregate
69126913

6913-
@Appender(_shared_docs["transform"] % _shared_doc_kwargs)
6914+
@doc(
6915+
NDFrame.transform,
6916+
klass=_shared_doc_kwargs["klass"],
6917+
axis=_shared_doc_kwargs["axis"],
6918+
)
69146919
def transform(self, func, axis=0, *args, **kwargs) -> "DataFrame":
69156920
axis = self._get_axis_number(axis)
69166921
if axis == 1:

pandas/core/generic.py

+39-38
Original file line numberDiff line numberDiff line change
@@ -5004,44 +5004,45 @@ def pipe(self, func, *args, **kwargs):
50045004

50055005
_shared_docs["aggregate"] = dedent(
50065006
"""
5007-
Aggregate using one or more operations over the specified axis.
5008-
%(versionadded)s
5009-
Parameters
5010-
----------
5011-
func : function, str, list or dict
5012-
Function to use for aggregating the data. If a function, must either
5013-
work when passed a {klass} or when passed to {klass}.apply.
5014-
5015-
Accepted combinations are:
5016-
5017-
- function
5018-
- string function name
5019-
- list of functions and/or function names, e.g. ``[np.sum, 'mean']``
5020-
- dict of axis labels -> functions, function names or list of such.
5021-
%(axis)s
5022-
*args
5023-
Positional arguments to pass to `func`.
5024-
**kwargs
5025-
Keyword arguments to pass to `func`.
5026-
5027-
Returns
5028-
-------
5029-
scalar, Series or DataFrame
5030-
5031-
The return can be:
5032-
5033-
* scalar : when Series.agg is called with single function
5034-
* Series : when DataFrame.agg is called with a single function
5035-
* DataFrame : when DataFrame.agg is called with several functions
5036-
5037-
Return scalar, Series or DataFrame.
5038-
%(see_also)s
5039-
Notes
5040-
-----
5041-
`agg` is an alias for `aggregate`. Use the alias.
5042-
5043-
A passed user-defined-function will be passed a Series for evaluation.
5044-
%(examples)s"""
5007+
Aggregate using one or more operations over the specified axis.
5008+
{versionadded}
5009+
Parameters
5010+
----------
5011+
func : function, str, list or dict
5012+
Function to use for aggregating the data. If a function, must either
5013+
work when passed a {klass} or when passed to {klass}.apply.
5014+
5015+
Accepted combinations are:
5016+
5017+
- function
5018+
- string function name
5019+
- list of functions and/or function names, e.g. ``[np.sum, 'mean']``
5020+
- dict of axis labels -> functions, function names or list of such.
5021+
{axis}
5022+
*args
5023+
Positional arguments to pass to `func`.
5024+
**kwargs
5025+
Keyword arguments to pass to `func`.
5026+
5027+
Returns
5028+
-------
5029+
scalar, Series or DataFrame
5030+
5031+
The return can be:
5032+
5033+
* scalar : when Series.agg is called with single function
5034+
* Series : when DataFrame.agg is called with a single function
5035+
* DataFrame : when DataFrame.agg is called with several functions
5036+
5037+
Return scalar, Series or DataFrame.
5038+
{see_also}
5039+
Notes
5040+
-----
5041+
`agg` is an alias for `aggregate`. Use the alias.
5042+
5043+
A passed user-defined-function will be passed a Series for evaluation.
5044+
{examples}
5045+
"""
50455046
)
50465047

50475048
# ----------------------------------------------------------------------

0 commit comments

Comments
 (0)