File tree 3 files changed +3
-2
lines changed
3 files changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -310,6 +310,7 @@ Groupby/Resample/Rolling
310
310
^^^^^^^^^^^^^^^^^^^^^^^^
311
311
312
312
- Bug when grouping by a single column and aggregating with a class like ``list`` or ``tuple`` (:issue:`18079`)
313
+ - Fixed regression in :func:`DataFrame.groupby` which would not emit an error when called with a tuple key not in the index (:issue:`18798`)
313
314
-
314
315
-
315
316
Original file line number Diff line number Diff line change @@ -2978,7 +2978,8 @@ def is_in_obj(gpr):
2978
2978
2979
2979
def _is_label_like (val ):
2980
2980
return (isinstance (val , compat .string_types ) or
2981
- (val is not None and is_scalar (val )))
2981
+ (val is not None and is_scalar (val )) or
2982
+ isinstance (val , tuple ))
2982
2983
2983
2984
2984
2985
def _convert_grouper (axis , grouper ):
Original file line number Diff line number Diff line change @@ -2750,7 +2750,6 @@ def test_tuple_warns_unhashable(self):
2750
2750
2751
2751
assert "Interpreting tuple 'by' as a list" in str (w [0 ].message )
2752
2752
2753
- @pytest .mark .xfail (reason = "GH-18798" )
2754
2753
def test_tuple_correct_keyerror (self ):
2755
2754
# https://github.com/pandas-dev/pandas/issues/18798
2756
2755
df = pd .DataFrame (1 , index = range (3 ),
You can’t perform that action at this time.
0 commit comments