diff --git a/pandas/tests/groupby/test_apply.py b/pandas/tests/groupby/test_apply.py index da6e7c6851667..49514f0b90cc5 100644 --- a/pandas/tests/groupby/test_apply.py +++ b/pandas/tests/groupby/test_apply.py @@ -968,9 +968,14 @@ def test_apply_function_with_indexing_return_column(): df = DataFrame( { "foo1": ["one", "two", "two", "three", "one", "two"], - "foo2": [1, 2, 3, 4, 5, 6], + "foo2": [1, 2, 4, 4, 5, 6], } ) result = df.groupby("foo1", as_index=False).apply(lambda x: x.mean()) - expected = df.groupby("foo1", as_index=False).mean() + expected = DataFrame( + { + "foo1": ["one", "three", "two"], + "foo2": [3.0, 4.0, 4.0], + } + ) tm.assert_frame_equal(result, expected)