Skip to content

Commit 659d55c

Browse files
committed
Review datapythonista for file groupby.rst
Signed-off-by: Fabian Haase <[email protected]>
1 parent 8da2376 commit 659d55c

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

doc/source/groupby.rst

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,8 @@
77
import numpy as np
88
import pandas as pd
99
10-
import matplotlib # noqa: F401
1110
import matplotlib.pyplot as plt
1211
13-
from collections import OrderedDict
14-
15-
# matplotlib.style.use('default')
1612
plt.close('all')
1713
1814
np.random.seed(123456)
@@ -569,8 +565,7 @@ need to rename, then you can add in a chained operation for a ``Series`` like th
569565
(grouped['C'].agg([np.sum, np.mean, np.std])
570566
.rename(columns={'sum': 'foo',
571567
'mean': 'bar',
572-
'std': 'baz'})
573-
)
568+
'std': 'baz'}))
574569
575570
For a grouped ``DataFrame``, you can rename in a similar manner:
576571

@@ -579,8 +574,7 @@ For a grouped ``DataFrame``, you can rename in a similar manner:
579574
(grouped.agg([np.sum, np.mean, np.std])
580575
.rename(columns={'sum': 'foo',
581576
'mean': 'bar',
582-
'std': 'baz'})
583-
)
577+
'std': 'baz'}))
584578
585579
586580
Applying different functions to DataFrame columns
@@ -610,6 +604,8 @@ must be either implemented on GroupBy or available via :ref:`dispatching
610604

611605
.. ipython:: python
612606
607+
from collections import OrderedDict
608+
613609
grouped.agg({'D': 'std', 'C': 'mean'})
614610
grouped.agg(OrderedDict([('D', 'std'), ('C', 'mean')]))
615611

0 commit comments

Comments
 (0)