@@ -132,6 +132,9 @@ def pinner(cls):
132132class SeriesGroupBy (GroupBy ):
133133 _apply_whitelist = base .series_apply_whitelist
134134
135+ def _iterate_slices (self ):
136+ yield self ._selection_name , self ._selected_obj
137+
135138 @property
136139 def _selection_name (self ):
137140 """
@@ -323,7 +326,7 @@ def _aggregate_multiple_funcs(self, arg, _level):
323326
324327 return DataFrame (results , columns = columns )
325328
326- def _wrap_output (self , output , index , names = None ):
329+ def _wrap_series_output (self , output , index , names = None ):
327330 """ common agg/transform wrapping logic """
328331 output = output [self ._selection_name ]
329332
@@ -336,13 +339,15 @@ def _wrap_output(self, output, index, names=None):
336339 return Series (output , index = index , name = name )
337340
338341 def _wrap_aggregated_output (self , output , names = None ):
339- result = self ._wrap_output (
342+ result = self ._wrap_series_output (
340343 output = output , index = self .grouper .result_index , names = names
341344 )
342345 return self ._reindex_output (result )._convert (datetime = True )
343346
344347 def _wrap_transformed_output (self , output , names = None ):
345- return self ._wrap_output (output = output , index = self .obj .index , names = names )
348+ return self ._wrap_series_output (
349+ output = output , index = self .obj .index , names = names
350+ )
346351
347352 def _wrap_applied_output (self , keys , values , not_indexed_same = False ):
348353 if len (keys ) == 0 :
@@ -866,7 +871,7 @@ def aggregate(self, func=None, *args, **kwargs):
866871 if self .grouper .nkeys > 1 :
867872 return self ._python_agg_general (func , * args , ** kwargs )
868873 elif args or kwargs :
869- result = self ._aggregate_generic (func , * args , ** kwargs )
874+ result = self ._aggregate_frame (func , * args , ** kwargs )
870875 else :
871876
872877 # try to treat as if we are passing a list
@@ -875,7 +880,7 @@ def aggregate(self, func=None, *args, **kwargs):
875880 [func ], _level = _level , _axis = self .axis
876881 )
877882 except Exception :
878- result = self ._aggregate_generic (func )
883+ result = self ._aggregate_frame (func )
879884 else :
880885 result .columns = Index (
881886 result .columns .levels [0 ], name = self ._selected_obj .columns .name
@@ -999,7 +1004,7 @@ def _cython_agg_blocks(self, how, alt=None, numeric_only=True, min_count=-1):
9991004
10001005 return new_items , new_blocks
10011006
1002- def _aggregate_generic (self , func , * args , ** kwargs ):
1007+ def _aggregate_frame (self , func , * args , ** kwargs ):
10031008 if self .grouper .nkeys != 1 :
10041009 raise AssertionError ("Number of keys must be 1" )
10051010
@@ -1022,7 +1027,7 @@ def _aggregate_generic(self, func, *args, **kwargs):
10221027 wrapper = lambda x : func (x , * args , ** kwargs )
10231028 result [name ] = data .apply (wrapper , axis = axis )
10241029
1025- return self ._wrap_generic_output (result , obj )
1030+ return self ._wrap_frame_output (result , obj )
10261031
10271032 def _aggregate_item_by_item (self , func , * args , ** kwargs ):
10281033 # only for axis==0
@@ -1506,7 +1511,7 @@ def _gotitem(self, key, ndim, subset=None):
15061511
15071512 raise AssertionError ("invalid ndim for _gotitem" )
15081513
1509- def _wrap_generic_output (self , result , obj ):
1514+ def _wrap_frame_output (self , result , obj ):
15101515 result_index = self .grouper .levels [0 ]
15111516
15121517 if self .axis == 0 :
0 commit comments