@@ -319,15 +319,11 @@ def aggregate(self, arg, *args, **kwargs):
319319 self ._set_binner ()
320320 result , how  =  self ._aggregate (arg , * args , ** kwargs )
321321 if  result  is  None :
322-  return  self ._groupby_and_aggregate (arg ,
323-  * args ,
324-  ** kwargs )
325- 
326-  # if arg was a string, _aggregate called resampler's _downsample or 
327-  # _groupby_and_agg methods, which would've already applied the loffset 
328-  if  not  isinstance (arg , compat .string_types ):
329-  result  =  self ._apply_loffset (result )
322+  result  =  self ._groupby_and_aggregate (arg ,
323+  * args ,
324+  ** kwargs )
330325
326+  result  =  self ._apply_loffset (result )
331327 return  result 
332328
333329 agg  =  aggregate 
@@ -410,31 +406,31 @@ def _groupby_and_aggregate(self, how, grouper=None, *args, **kwargs):
410406 result  =  grouped .apply (how , * args , ** kwargs )
411407
412408 result  =  self ._apply_loffset (result )
413- 
414409 return  self ._wrap_result (result )
415410
416411 def  _apply_loffset (self , result ):
417412 """ 
418413 if loffset is set, offset the result index 
419414
415+  This is NOT an idempotent routine, it will be applied 
416+  exactly once to the result. 
417+ 
420418 Parameters 
421419 ---------- 
422420 result : Series or DataFrame 
423421 the result of resample 
424422 """ 
425-  loffset  =  self .loffset 
426-  if  isinstance (loffset , compat .string_types ):
427-  loffset  =  to_offset (self .loffset )
428423
429424 needs_offset  =  (
430-  isinstance (loffset , (DateOffset , timedelta )) and 
425+  isinstance (self . loffset , (DateOffset , timedelta )) and 
431426 isinstance (result .index , DatetimeIndex ) and 
432427 len (result .index ) >  0 
433428 )
434429
435430 if  needs_offset :
436-  result .index  =  result .index  +  loffset 
431+  result .index  =  result .index  +  self . loffset 
437432
433+  self .loffset  =  None 
438434 return  result 
439435
440436 def  _get_resampler_for_grouping (self , groupby , ** kwargs ):
@@ -445,6 +441,7 @@ def _wrap_result(self, result):
445441 """ potentially wrap any results """ 
446442 if  isinstance (result , com .ABCSeries ) and  self ._selection  is  not   None :
447443 result .name  =  self ._selection 
444+ 
448445 return  result 
449446
450447 def  pad (self , limit = None ):
@@ -706,7 +703,6 @@ def _downsample(self, how, **kwargs):
706703 self .grouper , axis = self .axis ).aggregate (how , ** kwargs )
707704
708705 result  =  self ._apply_loffset (result )
709- 
710706 return  self ._wrap_result (result )
711707
712708 def  _adjust_binner_for_upsample (self , binner ):
@@ -810,11 +806,7 @@ def aggregate(self, arg, *args, **kwargs):
810806 if  result  is  None :
811807 result  =  self ._downsample (arg , * args , ** kwargs )
812808
813-  # if arg was a string, _aggregate called resamplers' _downsample or 
814-  # _groupby_and_agg methods, which would've already applied the loffset 
815-  if  not  isinstance (arg , compat .string_types ):
816-  result  =  self ._apply_loffset (result )
817- 
809+  result  =  self ._apply_loffset (result )
818810 return  result 
819811
820812 agg  =  aggregate 
@@ -1022,7 +1014,10 @@ def __init__(self, freq='Min', closed=None, label=None, how='mean',
10221014 self .convention  =  convention  or  'E' 
10231015 self .convention  =  self .convention .lower ()
10241016
1017+  if  isinstance (loffset , compat .string_types ):
1018+  loffset  =  to_offset (loffset )
10251019 self .loffset  =  loffset 
1020+ 
10261021 self .how  =  how 
10271022 self .fill_method  =  fill_method 
10281023 self .limit  =  limit 
0 commit comments