From 47d2da6caba379f586e4c905204c5e2f5a03fe7c Mon Sep 17 00:00:00 2001 From: gfyoung Date: Mon, 5 Nov 2018 02:19:28 -0800 Subject: [PATCH] DOC: Fix syntax error in groupby docs (#23498) Follow-up to gh-23394. --- doc/source/groupby.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/source/groupby.rst b/doc/source/groupby.rst index 0a896bac0f2d72..17a723e2a2f425 100644 --- a/doc/source/groupby.rst +++ b/doc/source/groupby.rst @@ -133,7 +133,8 @@ but the specified columns .. ipython:: python df2 = df.set_index(['A', 'B']) - grouped = df2.groupby(level=df2.index.names.difference(['B']) + grouped = df2.groupby(level=df2.index.names.difference(['B'])) + grouped.sum() These will split the DataFrame on its index (rows). We could also split by the columns: