@@ -380,7 +380,8 @@ def get_func(fname):
380380
381381 # otherwise find dtype-specific version, falling back to object
382382 for dt in [dtype_str , 'object' ]:
383- f = getattr (libgroupby , "%s_%s" % (fname , dtype_str ), None )
383+ f = getattr (libgroupby , "{fname}_{dtype_str}" .format (
384+ fname = fname , dtype_str = dtype_str ), None )
384385 if f is not None :
385386 return f
386387
@@ -403,9 +404,11 @@ def wrapper(*args, **kwargs):
403404 func = get_func (ftype )
404405
405406 if func is None :
406- raise NotImplementedError ("function is not implemented for this"
407- "dtype: [how->%s,dtype->%s]" %
408- (how , dtype_str ))
407+ raise NotImplementedError (
408+ "function is not implemented for this dtype: "
409+ "[how->{how},dtype->{dtype_str}]" .format (how = how ,
410+ dtype_str = dtype_str ))
411+
409412 return func
410413
411414 def _cython_operation (self , kind , values , how , axis , min_count = - 1 ,
@@ -485,7 +488,8 @@ def _cython_operation(self, kind, values, how, axis, min_count=-1,
485488 out_dtype = 'float'
486489 else :
487490 if is_numeric :
488- out_dtype = '%s%d' % (values .dtype .kind , values .dtype .itemsize )
491+ out_dtype = '{kind}{itemsize}' .format (
492+ kind = values .dtype .kind , itemsize = values .dtype .itemsize )
489493 else :
490494 out_dtype = 'object'
491495
@@ -739,10 +743,6 @@ def group_info(self):
739743 obs_group_ids .astype ('int64' , copy = False ),
740744 ngroups )
741745
742- @cache_readonly
743- def ngroups (self ):
744- return len (self .result_index )
745-
746746 @cache_readonly
747747 def result_index (self ):
748748 if len (self .binlabels ) != 0 and isna (self .binlabels [0 ]):
@@ -769,11 +769,6 @@ def agg_series(self, obj, func):
769769 grouper = reduction .SeriesBinGrouper (obj , func , self .bins , dummy )
770770 return grouper .get_result ()
771771
772- # ----------------------------------------------------------------------
773- # cython aggregation
774-
775- _cython_functions = copy .deepcopy (BaseGrouper ._cython_functions )
776-
777772
778773def _get_axes (group ):
779774 if isinstance (group , Series ):
@@ -853,9 +848,6 @@ def _chop(self, sdata, slice_obj):
853848
854849class FrameSplitter (DataSplitter ):
855850
856- def __init__ (self , data , labels , ngroups , axis = 0 ):
857- super (FrameSplitter , self ).__init__ (data , labels , ngroups , axis = axis )
858-
859851 def fast_apply (self , f , names ):
860852 # must return keys::list, values::list, mutated::bool
861853 try :
0 commit comments