@@ -1023,6 +1023,11 @@ class TimeGrouper(Grouper):
1023
1023
directly from the associated object
1024
1024
"""
1025
1025
1026
+ _attributes = ['key' , 'level' , 'freq' , 'axis' , 'sort' , 'closed' , 'label' ,
1027
+ 'how' , 'nperiods' , 'fill_method' , 'limit' ,
1028
+ 'loffset' , 'kind' , 'convention' , 'base' ]
1029
+ _end_types = {'M' , 'A' , 'Q' , 'BM' , 'BA' , 'BQ' , 'W' }
1030
+
1026
1031
def __init__ (self , freq = 'Min' , closed = None , label = None , how = 'mean' ,
1027
1032
nperiods = None , axis = 0 ,
1028
1033
fill_method = None , limit = None , loffset = None , kind = None ,
@@ -1066,14 +1071,6 @@ def __init__(self, freq='Min', closed=None, label=None, how='mean',
1066
1071
1067
1072
super (TimeGrouper , self ).__init__ (freq = freq , axis = axis , ** kwargs )
1068
1073
1069
- # _attributes is used in __repr__below
1070
- _attributes = Grouper ._attributes .copy ()
1071
- _attributes .update (
1072
- (k , v ) for k , v in zip (compat .signature (__init__ ).args [1 :],
1073
- compat .signature (__init__ ).defaults ))
1074
- _attributes .update (sort = True , convention = 'e' )
1075
- _end_types = {'M' , 'A' , 'Q' , 'BM' , 'BA' , 'BQ' , 'W' }
1076
-
1077
1074
def _get_resampler (self , obj , kind = None ):
1078
1075
"""
1079
1076
return my resampler or raise if we have an invalid axis
@@ -1296,25 +1293,6 @@ def _get_period_bins(self, ax):
1296
1293
1297
1294
return binner , bins , labels
1298
1295
1299
- def __repr__ (self ):
1300
- defaults = self ._attributes .copy ()
1301
- end_types = self ._end_types
1302
- rule = self .freq .rule_code
1303
- if (rule in end_types or
1304
- ('-' in rule and rule [:rule .find ('-' )] in end_types )):
1305
- defaults .update (closed = 'right' , label = 'right' )
1306
- else :
1307
- defaults .update (closed = 'left' , label = 'left' )
1308
-
1309
- sd = self .__dict__
1310
- attrs = collections .OrderedDict ((k , sd [k ]) for k , v in defaults .items ()
1311
- if k in sd and sd [k ] != v )
1312
- if 'freq' in attrs :
1313
- attrs ['freq' ] = attrs ['freq' ].freqstr
1314
- attrs = ", " .join ("{}={!r}" .format (k , v ) for k , v in attrs .items ())
1315
- cls_name = self .__class__ .__name__
1316
- return "{}({})" .format (cls_name , attrs )
1317
-
1318
1296
1319
1297
def _take_new_index (obj , indexer , new_index , axis = 0 ):
1320
1298
from pandas .core .api import Series , DataFrame
0 commit comments