diff --git a/pandas/tests/groupby/test_groupby.py b/pandas/tests/groupby/test_groupby.py index 6a11f0ae9b44a..c062fb90ca43b 100644 --- a/pandas/tests/groupby/test_groupby.py +++ b/pandas/tests/groupby/test_groupby.py @@ -1714,3 +1714,12 @@ def test_groupby_multiindex_nat(): result = ser.groupby(level=1).mean() expected = pd.Series([3., 2.5], index=["a", "b"]) assert_series_equal(result, expected) + + +def test_groupby_empty_list_raises(): + # GH 5289 + values = zip(range(10), range(10)) + df = DataFrame(values, columns=['apple', 'b']) + msg = "Grouper and axis must be same length" + with pytest.raises(ValueError, match=msg): + df.groupby([[]])