Skip to content

Commit cf250a8

Browse files
author
pdpark
committed
Doc: Add warning to treat group chunks as immutable
Resolves: pandas-dev#14180
1 parent 982e112 commit cf250a8

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
@@ -944,13 +944,17 @@ that is itself a series, and possibly upcast the result to a DataFrame:
944944
So depending on the path taken, and exactly what you are grouping. Thus the grouped columns(s) may be included in
945945
the output as well as set the indices.
946946

947-
.. warning::
947+
.. warnings::
948948

949-
In the current implementation apply calls func twice on the
949+
* In the current implementation apply calls func twice on the
950950
first group to decide whether it can take a fast or slow code
951951
path. This can lead to unexpected behavior if func has
952952
side-effects, as they will take effect twice for the first
953953
group.
954+
955+
* Apply should not perform in-place operations on the group chunk.
956+
Group chunks should be treated as immutable, and changes to a
957+
group chunk may produce unexpected results.
954958

955959
.. ipython:: python
956960

0 commit comments

Comments
 (0)