Skip to content

Commit b98e0ce

Browse files
author
Patrick Park
committed
Doc: Add warning to treat group chunks as immutable
Resolves: pandas-dev#14180
1 parent 913f71f commit b98e0ce

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

doc/source/groupby.rst

+5-1
Original file line numberDiff line numberDiff line change
@@ -941,11 +941,15 @@ that is itself a series, and possibly upcast the result to a DataFrame:
941941

942942
.. warning::
943943

944-
In the current implementation apply calls func twice on the
944+
* In the current implementation ``apply`` calls func twice on the
945945
first group to decide whether it can take a fast or slow code
946946
path. This can lead to unexpected behavior if func has
947947
side-effects, as they will take effect twice for the first
948948
group.
949+
950+
* For predictable results and performance, func should **not** mutate
951+
any of the group chunks. Group chunks should be treated as immutable
952+
since changes to a group chunk may produce unexpected results.
949953

950954
.. ipython:: python
951955

0 commit comments

Comments
 (0)