Skip to content

Commit 519fa10

Browse files
committed
use DataFrame instead of pd.DataFrame for test
1 parent 432ffba commit 519fa10

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

pandas/tests/groupby/test_apply.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1334,8 +1334,10 @@ def test_result_name_when_one_group(name):
13341334

13351335

13361336
def test_empty_df():
1337-
empty_df = pd.DataFrame({"a": [], "b": []})
1337+
empty_df = DataFrame({"a": [], "b": []})
1338+
1339+
# Both operations should return an empty series instead of IndexError for apply UDF
13381340
result = empty_df.groupby("a").b.apply(lambda x: x.values[-1])
1339-
expected = empty_df.groupby("a").b.take([0])
1341+
expected = empty_df.groupby("a").b.agg("sum")
13401342

13411343
tm.assert_series_equal(result, expected)

0 commit comments

Comments
 (0)