Skip to content

Commit 2736ec8

Browse files
DOC: Move notes to appropriate section in agg and aggregate docs (#52267)
1 parent 1f9e8e7 commit 2736ec8

File tree

2 files changed

+9
-11
lines changed

2 files changed

+9
-11
lines changed

pandas/core/frame.py

+2-11
Original file line numberDiff line numberDiff line change
@@ -9562,17 +9562,8 @@ def _gotitem(
95629562
# TODO: _shallow_copy(subset)?
95639563
return subset[key]
95649564

9565-
_agg_summary_and_see_also_doc = dedent(
9565+
_agg_see_also_doc = dedent(
95669566
"""
9567-
The aggregation operations are always performed over an axis, either the
9568-
index (default) or the column axis. This behavior is different from
9569-
`numpy` aggregation functions (`mean`, `median`, `prod`, `sum`, `std`,
9570-
`var`), where the default is to compute the aggregation of the flattened
9571-
array, e.g., ``numpy.mean(arr_2d)`` as opposed to
9572-
``numpy.mean(arr_2d, axis=0)``.
9573-
9574-
`agg` is an alias for `aggregate`. Use the alias.
9575-
95769567
See Also
95779568
--------
95789569
DataFrame.apply : Perform any type of operations.
@@ -9635,7 +9626,7 @@ def _gotitem(
96359626
_shared_docs["aggregate"],
96369627
klass=_shared_doc_kwargs["klass"],
96379628
axis=_shared_doc_kwargs["axis"],
9638-
see_also=_agg_summary_and_see_also_doc,
9629+
see_also=_agg_see_also_doc,
96399630
examples=_agg_examples_doc,
96409631
)
96419632
def aggregate(self, func=None, axis: Axis = 0, *args, **kwargs):

pandas/core/shared_docs.py

+7
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,13 @@
3939
{see_also}
4040
Notes
4141
-----
42+
The aggregation operations are always performed over an axis, either the
43+
index (default) or the column axis. This behavior is different from
44+
`numpy` aggregation functions (`mean`, `median`, `prod`, `sum`, `std`,
45+
`var`), where the default is to compute the aggregation of the flattened
46+
array, e.g., ``numpy.mean(arr_2d)`` as opposed to
47+
``numpy.mean(arr_2d, axis=0)``.
48+
4249
`agg` is an alias for `aggregate`. Use the alias.
4350
4451
Functions that mutate the passed object can produce unexpected

0 commit comments

Comments
 (0)