Skip to content

Commit 01650a8

Browse files
authored
DOC: fix cookbook groupby & transform example (#46957)
Negate first argument of `DataFrame.where`, since in pandas this must be the condition where the value should stay the same.
1 parent d86e200 commit 01650a8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

doc/source/user_guide/cookbook.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ Unlike agg, apply's callable is passed a sub-DataFrame which gives you access to
511511
512512
def replace(g):
513513
mask = g < 0
514-
return g.where(mask, g[~mask].mean())
514+
return g.where(~mask, g[~mask].mean())
515515
516516
gb.transform(replace)
517517

0 commit comments

Comments
 (0)