File tree 1 file changed +10
-0
lines changed
1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change 13
13
matplotlib.style.use(' ggplot' )
14
14
import matplotlib.pyplot as plt
15
15
plt.close(' all' )
16
+ from collections import OrderedDict
16
17
17
18
*****************************
18
19
Group By: split-apply-combine
@@ -487,6 +488,15 @@ must be either implemented on GroupBy or available via :ref:`dispatching
487
488
488
489
grouped.agg({' C' : ' sum' , ' D' : ' std' })
489
490
491
+ Note that if you pass a dict to ``aggregate ``, the ordering of the output colums is
492
+ non-deterministic. If you want to be sure the output columns will be in a specific
493
+ order, you can use an ``OrderedDict ``. Compare the output of the following two commands:
494
+
495
+ .. ipython :: python
496
+
497
+ grouped.agg({' D' : ' std' , ' C' : ' mean' })
498
+ grouped.agg(OrderedDict([(' D' , ' std' ), (' C' , ' mean' )]))
499
+
490
500
.. _groupby.aggregate.cython :
491
501
492
502
Cython-optimized aggregation functions
You can’t perform that action at this time.
0 commit comments