@@ -3438,6 +3438,13 @@ def test_filter_and_transform_with_non_unique_string_index(self):
3438
3438
actual = grouped_df .pid .transform (len )
3439
3439
assert_series_equal (actual , expected )
3440
3440
3441
+ def test_filter_has_access_to_grouped_cols (self ):
3442
+ df = DataFrame ([[1 , 2 ], [1 , 3 ], [5 , 6 ]], columns = ['A' , 'B' ])
3443
+ g = df .groupby ('A' )
3444
+ # previously didn't have access to col A #????
3445
+ filt = g .filter (lambda x : x ['A' ].sum () == 2 )
3446
+ assert_frame_equal (filt , df .iloc [[0 , 1 ]])
3447
+
3441
3448
def test_index_label_overlaps_location (self ):
3442
3449
# checking we don't have any label/location confusion in the
3443
3450
# the wake of GH5375
@@ -3486,7 +3493,8 @@ def test_groupby_selection_with_methods(self):
3486
3493
'idxmin' , 'idxmax' ,
3487
3494
'ffill' , 'bfill' ,
3488
3495
'pct_change' ,
3489
- 'tshift'
3496
+ 'tshift' ,
3497
+ #'ohlc'
3490
3498
]
3491
3499
3492
3500
for m in methods :
@@ -3501,8 +3509,11 @@ def test_groupby_selection_with_methods(self):
3501
3509
g_exp .apply (lambda x : x .sum ()))
3502
3510
3503
3511
assert_frame_equal (g .resample ('D' ), g_exp .resample ('D' ))
3512
+ assert_frame_equal (g .resample ('D' , how = 'ohlc' ),
3513
+ g_exp .resample ('D' , how = 'ohlc' ))
3504
3514
3505
-
3515
+ assert_frame_equal (g .filter (lambda x : len (x ) == 3 ),
3516
+ g_exp .filter (lambda x : len (x ) == 3 ))
3506
3517
3507
3518
def test_groupby_whitelist (self ):
3508
3519
from string import ascii_lowercase
0 commit comments