2525 notnull , _DATELIKE_DTYPES , is_numeric_dtype ,
2626 is_timedelta64_dtype , is_datetime64_dtype ,
2727 is_categorical_dtype , _values_from_object ,
28- is_datetime_or_timedelta_dtype , is_bool_dtype )
28+ is_datetime_or_timedelta_dtype , is_bool_dtype ,
29+ AbstractMethodError )
2930from pandas .core .config import option_context
3031import pandas .lib as lib
3132from pandas .lib import Timestamp
@@ -279,7 +280,7 @@ def _set_grouper(self, obj, sort=False):
279280 return self .grouper
280281
281282 def _get_binner_for_grouping (self , obj ):
282- raise NotImplementedError
283+ raise AbstractMethodError ( self )
283284
284285 @property
285286 def groups (self ):
@@ -670,7 +671,7 @@ def _python_apply_general(self, f):
670671 not_indexed_same = mutated )
671672
672673 def aggregate (self , func , * args , ** kwargs ):
673- raise NotImplementedError
674+ raise AbstractMethodError ( self )
674675
675676 @Appender (_agg_doc )
676677 def agg (self , func , * args , ** kwargs ):
@@ -680,7 +681,7 @@ def _iterate_slices(self):
680681 yield self .name , self ._selected_obj
681682
682683 def transform (self , func , * args , ** kwargs ):
683- raise NotImplementedError
684+ raise AbstractMethodError ( self )
684685
685686 def mean (self ):
686687 """
@@ -1127,7 +1128,7 @@ def _python_agg_general(self, func, *args, **kwargs):
11271128 return self ._wrap_aggregated_output (output )
11281129
11291130 def _wrap_applied_output (self , * args , ** kwargs ):
1130- raise NotImplementedError
1131+ raise AbstractMethodError ( self )
11311132
11321133 def _concat_objects (self , keys , values , not_indexed_same = False ):
11331134 from pandas .tools .merge import concat
@@ -1484,7 +1485,8 @@ def aggregate(self, values, how, axis=0):
14841485 swapped = True
14851486 values = values .swapaxes (0 , axis )
14861487 if arity > 1 :
1487- raise NotImplementedError
1488+ raise NotImplementedError ("arity of more than 1 is not "
1489+ "supported for the 'how' argument" )
14881490 out_shape = (self .ngroups ,) + values .shape [1 :]
14891491
14901492 is_numeric = is_numeric_dtype (values .dtype )
@@ -1556,7 +1558,8 @@ def _aggregate(self, result, counts, values, agg_func, is_numeric):
15561558 comp_ids , _ , ngroups = self .group_info
15571559 if values .ndim > 3 :
15581560 # punting for now
1559- raise NotImplementedError
1561+ raise NotImplementedError ("number of dimensions is currently "
1562+ "limited to 3" )
15601563 elif values .ndim > 2 :
15611564 for i , chunk in enumerate (values .transpose (2 , 0 , 1 )):
15621565
@@ -1815,7 +1818,8 @@ def _aggregate(self, result, counts, values, agg_func, is_numeric=True):
18151818
18161819 if values .ndim > 3 :
18171820 # punting for now
1818- raise NotImplementedError
1821+ raise NotImplementedError ("number of dimensions is currently "
1822+ "limited to 3" )
18191823 elif values .ndim > 2 :
18201824 for i , chunk in enumerate (values .transpose (2 , 0 , 1 )):
18211825 agg_func (result [:, :, i ], counts , chunk , self .bins )
@@ -2622,7 +2626,8 @@ def aggregate(self, arg, *args, **kwargs):
26222626 if self ._selection is not None :
26232627 subset = obj
26242628 if isinstance (subset , DataFrame ):
2625- raise NotImplementedError
2629+ raise NotImplementedError ("Aggregating on a DataFrame is "
2630+ "not supported" )
26262631
26272632 for fname , agg_how in compat .iteritems (arg ):
26282633 colg = SeriesGroupBy (subset , selection = self ._selection ,
@@ -2671,7 +2676,7 @@ def _aggregate_multiple_funcs(self, arg):
26712676 from pandas .tools .merge import concat
26722677
26732678 if self .axis != 0 :
2674- raise NotImplementedError
2679+ raise NotImplementedError ( "axis other than 0 is not supported" )
26752680
26762681 obj = self ._obj_with_exclusions
26772682
@@ -2721,7 +2726,7 @@ def _aggregate_generic(self, func, *args, **kwargs):
27212726 return self ._wrap_generic_output (result , obj )
27222727
27232728 def _wrap_aggregated_output (self , output , names = None ):
2724- raise NotImplementedError
2729+ raise AbstractMethodError ( self )
27252730
27262731 def _aggregate_item_by_item (self , func , * args , ** kwargs ):
27272732 # only for axis==0
@@ -3283,7 +3288,7 @@ def _iterate_slices(self):
32833288 slice_axis = self ._selection_list
32843289 slicer = lambda x : self ._selected_obj [x ]
32853290 else :
3286- raise NotImplementedError
3291+ raise NotImplementedError ( "axis other than 0 is not supported" )
32873292
32883293 for val in slice_axis :
32893294 if val in self .exclusions :
@@ -3348,10 +3353,10 @@ def _aggregate_item_by_item(self, func, *args, **kwargs):
33483353 new_axes [self .axis ] = self .grouper .result_index
33493354 return Panel ._from_axes (result , new_axes )
33503355 else :
3351- raise NotImplementedError
3356+ raise ValueError ( "axis value must be greater than 0" )
33523357
33533358 def _wrap_aggregated_output (self , output , names = None ):
3354- raise NotImplementedError
3359+ raise AbstractMethodError ( self )
33553360
33563361
33573362class NDArrayGroupBy (GroupBy ):
@@ -3405,7 +3410,7 @@ def _chop(self, sdata, slice_obj):
34053410 return sdata .iloc [slice_obj ]
34063411
34073412 def apply (self , f ):
3408- raise NotImplementedError
3413+ raise AbstractMethodError ( self )
34093414
34103415
34113416class ArraySplitter (DataSplitter ):
0 commit comments