Skip to content

Commit ba56977

Browse files
committed
fixed doc strings
1 parent 2113d89 commit ba56977

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
@@ -6762,13 +6762,14 @@ def _gotitem(
67626762
"""
67636763
)
67646764

6765-
@Substitution(
6765+
@doc(
6766+
_shared_docs["aggregate"],
6767+
klass=_shared_doc_kwargs["klass"],
6768+
axis=_shared_doc_kwargs["axis"],
67666769
see_also=_agg_summary_and_see_also_doc,
67676770
examples=_agg_examples_doc,
67686771
versionadded="\n.. versionadded:: 0.20.0\n",
6769-
**_shared_doc_kwargs,
67706772
)
6771-
@Appender(_shared_docs["aggregate"])
67726773
def aggregate(self, func, axis=0, *args, **kwargs):
67736774
axis = self._get_axis_number(axis)
67746775

@@ -6792,7 +6793,11 @@ def _aggregate(self, arg, axis=0, *args, **kwargs):
67926793

67936794
agg = aggregate
67946795

6795-
@Appender(_shared_docs["transform"] % _shared_doc_kwargs)
6796+
@doc(
6797+
NDFrame.transform,
6798+
klass=_shared_doc_kwargs["klass"],
6799+
axis=_shared_doc_kwargs["axis"],
6800+
)
67966801
def transform(self, func, axis=0, *args, **kwargs) -> "DataFrame":
67976802
axis = self._get_axis_number(axis)
67986803
if axis == 1:

pandas/core/generic.py

Lines changed: 39 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -5000,44 +5000,45 @@ def pipe(self, func, *args, **kwargs):
50005000

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

50435044
# ----------------------------------------------------------------------

0 commit comments

Comments
 (0)