Skip to content
Prev Previous commit
Next Next commit
add test
  • Loading branch information
weikhor authored and weikhor committed Jun 4, 2022
commit aa14a7cc4ee2a102b50a7550f806be0e2c962201
8 changes: 8 additions & 0 deletions pandas/tests/apply/test_frame_apply.py
Original file line number Diff line number Diff line change
Expand Up @@ -1577,3 +1577,11 @@ def test_apply_type():
result = df.apply(type, axis=1)
expected = Series({"a": Series, "b": Series, "c": Series})
tm.assert_series_equal(result, expected)


def test_apply_on_empty_dataframe():
# GH 39111
df = DataFrame({"a": [1, 2], "b": [3, 0]})
result = df.head(0).apply(lambda x: max(x["a"], x["b"]), axis=1)
expected = Series([])
tm.assert_series_equal(result, expected)