diff --git a/doc/source/groupby.rst b/doc/source/groupby.rst index 0a896bac0f2d7..17a723e2a2f42 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: