8
8
from pandas .core .index import Index , MultiIndex
9
9
from pandas .core .common import rands , groupby
10
10
from pandas .core .frame import DataFrame
11
+ from pandas .core .groupby import GroupByError
11
12
from pandas .core .series import Series
12
13
from pandas .util .testing import (assert_panel_equal , assert_frame_equal ,
13
14
assert_series_equal , assert_almost_equal )
@@ -659,7 +660,6 @@ def _testit(op):
659
660
_testit (lambda x : x .sum ())
660
661
_testit (lambda x : x .mean ())
661
662
662
-
663
663
def test_cython_agg_boolean (self ):
664
664
frame = DataFrame ({'a' : np .random .randint (0 , 5 , 50 ),
665
665
'b' : np .random .randint (0 , 2 , 50 ).astype ('bool' )})
@@ -668,6 +668,11 @@ def test_cython_agg_boolean(self):
668
668
669
669
assert_series_equal (result , expected )
670
670
671
+ def test_cython_agg_nothing_to_agg (self ):
672
+ frame = DataFrame ({'a' : np .random .randint (0 , 5 , 50 ),
673
+ 'b' : ['foo' , 'bar' ] * 25 })
674
+ self .assertRaises (GroupByError , frame .groupby ('a' )['b' ].mean )
675
+
671
676
def test_grouping_attrs (self ):
672
677
deleveled = self .mframe .delevel ()
673
678
grouped = deleveled .groupby (['first' , 'second' ])
0 commit comments