@@ -142,6 +142,11 @@ def _last(x):
142142 else :
143143 return _last (x )
144144
145+
146+ def _count_compat (x , axis = 0 ):
147+ return x .size
148+
149+
145150class Grouper (object ):
146151 """
147152 A Grouper allows the user to specify a groupby instruction for a target object
@@ -721,8 +726,7 @@ def size(self):
721726 numeric_only = False , _convert = True )
722727 last = _groupby_function ('last' , 'last' , _last_compat , numeric_only = False ,
723728 _convert = True )
724-
725- _count = _groupby_function ('_count' , 'count' , lambda x , axis = 0 : x .size (),
729+ _count = _groupby_function ('_count' , 'count' , _count_compat ,
726730 numeric_only = False )
727731
728732 def count (self , axis = 0 ):
@@ -1395,8 +1399,7 @@ def aggregate(self, values, how, axis=0):
13951399 values = values .astype (object )
13961400
13971401 # will be filled in Cython function
1398- result = np .empty (out_shape ,
1399- dtype = np .dtype ('f%d' % values .dtype .itemsize ))
1402+ result = np .empty (out_shape , dtype = 'f%d' % values .dtype .itemsize )
14001403 result .fill (np .nan )
14011404 counts = np .zeros (self .ngroups , dtype = np .int64 )
14021405
@@ -1441,7 +1444,6 @@ def _aggregate(self, result, counts, values, how, is_numeric):
14411444 chunk = chunk .squeeze ()
14421445 agg_func (result [:, :, i ], counts , chunk , comp_ids )
14431446 else :
1444- #import ipdb; ipdb.set_trace() # XXX BREAKPOINT
14451447 agg_func (result , counts , values , comp_ids )
14461448
14471449 return trans_func (result )
0 commit comments