From 6a73a592a9b4ef38a8b611722c16011e85b8c9bd Mon Sep 17 00:00:00 2001 From: th3nn3ss Date: Wed, 31 Aug 2022 15:18:27 +0100 Subject: [PATCH 1/2] add test for empty input construct --- pandas/tests/frame/test_constructors.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pandas/tests/frame/test_constructors.py b/pandas/tests/frame/test_constructors.py index b4f027f3a832a..041150fa90f0a 100644 --- a/pandas/tests/frame/test_constructors.py +++ b/pandas/tests/frame/test_constructors.py @@ -3177,3 +3177,9 @@ def test_frame_allow_non_nano(self, arr): def test_frame_from_dict_allow_non_nano(self, arr): df = DataFrame({0: arr}) assert df.dtypes[0] == arr.dtype + +def test_empty_constructs(): + result = pd.DataFrame({"a": pd.Series([]), "b": pd.Series([])}) + expected = pd.DataFrame(columns=["a", "b"]) + + tm.assert_frame_equal(result, expected) \ No newline at end of file From 9e09c6fdc632d3c7ce1b17591c6950f84e4363a7 Mon Sep 17 00:00:00 2001 From: th3nn3ss Date: Wed, 31 Aug 2022 15:40:08 +0100 Subject: [PATCH 2/2] precommit --- pandas/tests/frame/test_constructors.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pandas/tests/frame/test_constructors.py b/pandas/tests/frame/test_constructors.py index 041150fa90f0a..12661a8cbb6cb 100644 --- a/pandas/tests/frame/test_constructors.py +++ b/pandas/tests/frame/test_constructors.py @@ -3178,8 +3178,9 @@ def test_frame_from_dict_allow_non_nano(self, arr): df = DataFrame({0: arr}) assert df.dtypes[0] == arr.dtype + def test_empty_constructs(): result = pd.DataFrame({"a": pd.Series([]), "b": pd.Series([])}) expected = pd.DataFrame(columns=["a", "b"]) - tm.assert_frame_equal(result, expected) \ No newline at end of file + tm.assert_frame_equal(result, expected)