Skip to content

Commit 82e6d70

Browse files
committed
Update groupby.rst
Edit following this remark <https://github.com/pydata/pandas/pull/6304/files#r9564092>
1 parent 2d04ec8 commit 82e6d70

File tree

1 file changed

+3
-18
lines changed

1 file changed

+3
-18
lines changed

doc/source/groupby.rst

+3-18
Original file line numberDiff line numberDiff line change
@@ -729,22 +729,7 @@ Examples
729729

730730
Regroup columns of a DataFrame according to their sum, and sum the aggregated ones.
731731

732-
.. ipython::
733-
734-
In [2]: dat = {'a':[1,0,0], 'b':[0,1,0], 'c':[1,0,0], 'd':[2,3,4]}
735-
736-
In [3]: df = pd.DataFrame(dat)
737-
738-
In [4]: df
739-
Out[4]:
740-
a b c d
741-
0 1 0 1 2
742-
1 0 1 0 3
743-
2 0 0 0 4
732+
.. ipython:: python
744733
745-
In [5]: df.groupby(df.sum(), axis=1).sum()
746-
Out[5]:
747-
1 9
748-
0 2 2
749-
1 1 3
750-
2 0 4
734+
df = pd.DataFrame({'a':[1,0,0], 'b':[0,1,0], 'c':[1,0,0], 'd':[2,3,4]})
735+
df.groupby(df.sum(), axis=1).sum()

0 commit comments

Comments
 (0)