@@ -40,9 +40,9 @@ New features
40
40
^^^^^^^^^^^
41
41
42
42
Series & DataFrame have been enhanced to support the aggregation API. This is an already familiar API that
43
- is supported for groupby, windows operations, and resampling. This allows one to express, possibly multiple
44
- aggregation operations in a single concise way by using `` .agg()`` and ``.transform()``. The
45
- full documentation is :ref:`here <basics.aggregate>`` (:issue:`1623`)
43
+ is supported for groupby, window operations, and resampling. This allows one to express, possibly multiple
44
+ aggregation operations, in a single concise way by using :meth:`~DataFrame .agg`,
45
+ and :meth:`~DataFrame.transform`. The full documentation is :ref:`here <basics.aggregate>`` (:issue:`1623`)
46
46
47
47
Here is a sample
48
48
@@ -67,28 +67,22 @@ Multiple functions in lists.
67
67
68
68
df.agg(['sum', 'min'])
69
69
70
- Dictionaries to provide the ability to selective calculation.
70
+ Dictionaries to provide the ability to provide selective aggregation per column.
71
+ You will get a matrix-like output of all of the aggregators. The output will consist
72
+ of all unique functions. Those that are not noted for a particular column will be ``NaN``:
71
73
72
74
.. ipython:: python
73
75
74
76
df.agg({'A' : ['sum', 'min'], 'B' : ['min', 'max']})
75
77
76
- When operating on a Series, passing a dictionry allows one to rename multiple
77
- function aggregates; this will return a MultiIndexed Series. The outer level
78
- are the keys, the inner are the names of the functions.
79
-
80
- .. ipython:: python
81
-
82
- df.A.agg({'foo':['sum', 'min'], 'bar' : ['count','max']})
83
-
84
78
The API also supports a ``.transform()`` function to provide for broadcasting results.
85
79
86
80
.. ipython:: python
87
81
88
- df.transform(['abs', lambda x: x- x.min()])
82
+ df.transform(['abs', lambda x: x - x.min()])
89
83
90
- When presented with mixed dtypes that cannot aggregate, ``.agg`` will only take the valid
91
- aggregations. This is similiar to how groupby ``.agg`` works. (:issue:`15015`)
84
+ When presented with mixed dtypes that cannot aggregate, ``.agg() `` will only take the valid
85
+ aggregations. This is similiar to how groupby ``.agg() `` works. (:issue:`15015`)
92
86
93
87
.. ipython:: python
94
88
0 commit comments