@@ -338,8 +338,7 @@ def aggregate(self, func=None, *args, **kwargs):
338
338
result = ResamplerWindowApply (self , func , args = args , kwargs = kwargs ).agg ()
339
339
if result is None :
340
340
how = func
341
- grouper = None
342
- result = self ._groupby_and_aggregate (how , grouper , * args , ** kwargs )
341
+ result = self ._groupby_and_aggregate (how , * args , ** kwargs )
343
342
344
343
result = self ._apply_loffset (result )
345
344
return result
@@ -409,12 +408,11 @@ def _gotitem(self, key, ndim: int, subset=None):
409
408
except KeyError :
410
409
return grouped
411
410
412
- def _groupby_and_aggregate (self , how , grouper = None , * args , ** kwargs ):
411
+ def _groupby_and_aggregate (self , how , * args , ** kwargs ):
413
412
"""
414
413
Re-evaluate the obj with a groupby aggregation.
415
414
"""
416
- if grouper is None :
417
- grouper = self .grouper
415
+ grouper = self .grouper
418
416
419
417
obj = self ._selected_obj
420
418
@@ -1055,7 +1053,7 @@ def __init__(self, obj, parent=None, groupby=None, **kwargs):
1055
1053
self .groupby = copy .copy (parent .groupby )
1056
1054
1057
1055
@no_type_check
1058
- def _apply (self , f , grouper = None , * args , ** kwargs ):
1056
+ def _apply (self , f , * args , ** kwargs ):
1059
1057
"""
1060
1058
Dispatch to _upsample; we are stripping all of the _upsample kwargs and
1061
1059
performing the original function call on the grouped object.
@@ -1296,15 +1294,15 @@ def _downsample(self, how, **kwargs):
1296
1294
1297
1295
if is_subperiod (ax .freq , self .freq ):
1298
1296
# Downsampling
1299
- return self ._groupby_and_aggregate (how , grouper = self . grouper , ** kwargs )
1297
+ return self ._groupby_and_aggregate (how , ** kwargs )
1300
1298
elif is_superperiod (ax .freq , self .freq ):
1301
1299
if how == "ohlc" :
1302
1300
# GH #13083
1303
1301
# upsampling to subperiods is handled as an asfreq, which works
1304
1302
# for pure aggregating/reducing methods
1305
1303
# OHLC reduces along the time dimension, but creates multiple
1306
1304
# values for each period -> handle by _groupby_and_aggregate()
1307
- return self ._groupby_and_aggregate (how , grouper = self . grouper )
1305
+ return self ._groupby_and_aggregate (how )
1308
1306
return self .asfreq ()
1309
1307
elif ax .freq == self .freq :
1310
1308
return self .asfreq ()
0 commit comments