Skip to content

Commit e212e78

Browse files
author
pdpark
committed
docs: Add warning to treat group chunks as immutable to "Flexible apply" section of groupby.rst
Resolves: pandas-dev#14180
1 parent 6cf1c2c commit e212e78

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

doc/source/groupby.rst

+6-2
Original file line numberDiff line numberDiff line change
@@ -915,13 +915,17 @@ The dimension of the returned result can also change:
915915
So depending on the path taken, and exactly what you are grouping. Thus the grouped columns(s) may be included in
916916
the output as well as set the indices.
917917

918-
.. warning::
918+
.. warnings::
919919

920-
In the current implementation apply calls func twice on the
920+
* In the current implementation apply calls func twice on the
921921
first group to decide whether it can take a fast or slow code
922922
path. This can lead to unexpected behavior if func has
923923
side-effects, as they will take effect twice for the first
924924
group.
925+
926+
* Apply should not perform in-place operations on the group chunk.
927+
Group chunks should be treated as immutable, and changes to a
928+
group chunk may produce unexpected results.
925929

926930
.. ipython:: python
927931

0 commit comments

Comments
 (0)