@@ -206,12 +206,13 @@ class Grouper(object):
206
206
sort : boolean, default to False
207
207
whether to sort the resulting labels
208
208
209
- additional kwargs to control time-like groupers (when freq is passed)
209
+ additional kwargs to control time-like groupers (when `` freq`` is passed)
210
210
211
- closed : closed end of interval; left or right
212
- label : interval boundary to use for labeling; left or right
211
+ closed : closed end of interval; ' left' or ' right'
212
+ label : interval boundary to use for labeling; ' left' or ' right'
213
213
convention : {'start', 'end', 'e', 's'}
214
214
If grouper is PeriodIndex
215
+ base, loffset
215
216
216
217
Returns
217
218
-------
@@ -233,6 +234,7 @@ class Grouper(object):
233
234
234
235
>>> df.groupby(Grouper(level='date', freq='60s', axis=1))
235
236
"""
237
+ _attributes = ('key' , 'level' , 'freq' , 'axis' , 'sort' )
236
238
237
239
def __new__ (cls , * args , ** kwargs ):
238
240
if kwargs .get ('freq' ) is not None :
@@ -333,6 +335,14 @@ def _set_grouper(self, obj, sort=False):
333
335
def groups (self ):
334
336
return self .grouper .groups
335
337
338
+ def __repr__ (self ):
339
+ attrs_list = ["{}={!r}" .format (attr_name , getattr (self , attr_name ))
340
+ for attr_name in self ._attributes
341
+ if getattr (self , attr_name ) is not None ]
342
+ attrs = ", " .join (attrs_list )
343
+ cls_name = self .__class__ .__name__
344
+ return "{}({})" .format (cls_name , attrs )
345
+
336
346
337
347
class GroupByPlot (PandasObject ):
338
348
"""
0 commit comments