@@ -141,25 +141,37 @@ def _last(x):
141
141
142
142
class Grouper (object ):
143
143
"""
144
- A Grouper allows the user to specify a groupby instruction
144
+ A Grouper allows the user to specify a groupby instruction for a target object
145
+
146
+ This specification will select a column via the key parameter, or if the level and/or
147
+ axis parameters are given, a level of the index of the target object.
148
+
149
+ These are local specifications and will override 'global' settings, that is the parameters
150
+ axis and level which are passed to the groupby itself.
145
151
146
152
Parameters
147
153
----------
148
- key : groupby key, default None
149
- level : name, int level number, default None
150
- freq : string / freqency object, default None
151
- sort : boolean, whether to sort the resulting labels, default True
154
+ key : string, defaults to None
155
+ groupby key, which selects the grouping column of the target
156
+ level : name/number, defaults to None
157
+ the level for the target index
158
+ freq : string / freqency object, defaults to None
159
+ This will groupby the specified frequency if the target selection (via key or level) is
160
+ a datetime-like object
161
+ axis : number/name of the axis, defaults to None
162
+ sort : boolean, default to False
163
+ whether to sort the resulting labels
152
164
153
165
Returns
154
166
-------
155
167
A specification for a groupby instruction
156
168
157
169
Examples
158
170
--------
159
- df.groupby(Group (key='A')) : syntatic sugar for df.groupby('A')
160
- df.groupby(Group (key='date',freq='60s')) : specify a resample on the column 'date'
161
- df.groupby(Group (level='date',freq='60s',axis=1)) :
162
- specify a resample on the level 'date' on the columns axis with a frequency of 60s
171
+ >>> df.groupby(Grouper (key='A')) : syntatic sugar for df.groupby('A')
172
+ >>> df.groupby(Grouper (key='date',freq='60s')) : specify a resample on the column 'date'
173
+ >>> df.groupby(Grouper (level='date',freq='60s',axis=1)) :
174
+ specify a resample on the level 'date' on the columns axis with a frequency of 60s
163
175
164
176
"""
165
177
0 commit comments