@@ -368,6 +368,7 @@ def test_attr_wrapper(ts):
368368 # get attribute
369369 result = grouped .dtype
370370 expected = grouped .agg (lambda x : x .dtype )
371+ tm .assert_series_equal (result , expected )
371372
372373 # make sure raises error
373374 msg = "'SeriesGroupBy' object has no attribute 'foo'"
@@ -1503,7 +1504,7 @@ def test_groupby_reindex_inside_function():
15031504 ind = date_range (start = "2012/1/1" , freq = "5min" , periods = periods )
15041505 df = DataFrame ({"high" : np .arange (periods ), "low" : np .arange (periods )}, index = ind )
15051506
1506- def agg_before (hour , func , fix = False ):
1507+ def agg_before (func , fix = False ):
15071508 """
15081509 Run an aggregate func on the subset of data.
15091510 """
@@ -1518,13 +1519,9 @@ def _func(data):
15181519
15191520 return _func
15201521
1521- def afunc (data ):
1522- d = data .select (lambda x : x .hour < 11 ).dropna ()
1523- return np .max (d )
1524-
15251522 grouped = df .groupby (lambda x : datetime (x .year , x .month , x .day ))
1526- closure_bad = grouped .agg ({"high" : agg_before (11 , np .max )})
1527- closure_good = grouped .agg ({"high" : agg_before (11 , np .max , True )})
1523+ closure_bad = grouped .agg ({"high" : agg_before (np .max )})
1524+ closure_good = grouped .agg ({"high" : agg_before (np .max , True )})
15281525
15291526 tm .assert_frame_equal (closure_bad , closure_good )
15301527
0 commit comments