@@ -380,7 +380,8 @@ def get_func(fname):
380
380
381
381
# otherwise find dtype-specific version, falling back to object
382
382
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 )
384
385
if f is not None :
385
386
return f
386
387
@@ -403,9 +404,11 @@ def wrapper(*args, **kwargs):
403
404
func = get_func (ftype )
404
405
405
406
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
+
409
412
return func
410
413
411
414
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,
485
488
out_dtype = 'float'
486
489
else :
487
490
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 )
489
493
else :
490
494
out_dtype = 'object'
491
495
@@ -739,10 +743,6 @@ def group_info(self):
739
743
obs_group_ids .astype ('int64' , copy = False ),
740
744
ngroups )
741
745
742
- @cache_readonly
743
- def ngroups (self ):
744
- return len (self .result_index )
745
-
746
746
@cache_readonly
747
747
def result_index (self ):
748
748
if len (self .binlabels ) != 0 and isna (self .binlabels [0 ]):
@@ -769,11 +769,6 @@ def agg_series(self, obj, func):
769
769
grouper = reduction .SeriesBinGrouper (obj , func , self .bins , dummy )
770
770
return grouper .get_result ()
771
771
772
- # ----------------------------------------------------------------------
773
- # cython aggregation
774
-
775
- _cython_functions = copy .deepcopy (BaseGrouper ._cython_functions )
776
-
777
772
778
773
def _get_axes (group ):
779
774
if isinstance (group , Series ):
@@ -853,9 +848,6 @@ def _chop(self, sdata, slice_obj):
853
848
854
849
class FrameSplitter (DataSplitter ):
855
850
856
- def __init__ (self , data , labels , ngroups , axis = 0 ):
857
- super (FrameSplitter , self ).__init__ (data , labels , ngroups , axis = axis )
858
-
859
851
def fast_apply (self , f , names ):
860
852
# must return keys::list, values::list, mutated::bool
861
853
try :
0 commit comments