Skip to content

Commit 9e81ad0

Browse files
committed
fixed doc strings
1 parent 8f3e473 commit 9e81ad0

File tree

2 files changed

+48
-42
lines changed

2 files changed

+48
-42
lines changed

pandas/core/frame.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6859,13 +6859,14 @@ def _gotitem(
68596859
"""
68606860
)
68616861

6862-
@Substitution(
6862+
@doc(
6863+
_shared_docs["aggregate"],
6864+
klass=_shared_doc_kwargs["klass"],
6865+
axis=_shared_doc_kwargs["axis"],
68636866
see_also=_agg_summary_and_see_also_doc,
68646867
examples=_agg_examples_doc,
68656868
versionadded="\n.. versionadded:: 0.20.0\n",
6866-
**_shared_doc_kwargs,
68676869
)
6868-
@Appender(_shared_docs["aggregate"])
68696870
def aggregate(self, func, axis=0, *args, **kwargs):
68706871
axis = self._get_axis_number(axis)
68716872

@@ -6889,7 +6890,11 @@ def _aggregate(self, arg, axis=0, *args, **kwargs):
68896890

68906891
agg = aggregate
68916892

6892-
@Appender(_shared_docs["transform"] % _shared_doc_kwargs)
6893+
@doc(
6894+
NDFrame.transform,
6895+
klass=_shared_doc_kwargs["klass"],
6896+
axis=_shared_doc_kwargs["axis"],
6897+
)
68936898
def transform(self, func, axis=0, *args, **kwargs) -> "DataFrame":
68946899
axis = self._get_axis_number(axis)
68956900
if axis == 1:

pandas/core/generic.py

Lines changed: 39 additions & 38 deletions
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)