Skip to content

Commit e2fbceb

Browse files
committed
Updated PR pandas-dev#6114 based on review feedback
1 parent 5dd7786 commit e2fbceb

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

pandas/tests/frame/test_constructors.py

+6
Original file line numberDiff line numberDiff line change
@@ -2780,6 +2780,12 @@ def test_construction_nan_value_timedelta64_dtype(self):
27802780
)
27812781
tm.assert_frame_equal(result, expected)
27822782

2783+
def test_from_records_empty_iterator_with_preserve_columns(self):
2784+
2785+
rows = []
2786+
df = pd.DataFrame.from_records(iter(rows), columns=["col_1", "Col_2"], nrows=0)
2787+
assert list(df.columns) == ["col_1", "Col_2"]
2788+
assert len(df) == 0
27832789

27842790
class TestDataFrameConstructorIndexInference:
27852791
def test_frame_from_dict_of_series_overlapping_monthly_period_indexes(self):

0 commit comments

Comments
 (0)