Skip to content

Commit 6f545b8

Browse files
author
Sumanau Sareen
committed
Added test for ensuring empty df has an empty index.
1 parent f6efb8d commit 6f545b8

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

pandas/tests/indexing/test_indexing.py

+5
Original file line numberDiff line numberDiff line change
@@ -627,6 +627,11 @@ def test_index_type_coercion(self):
627627
idxr(s2)['0'] = 0
628628
assert s2.index.is_object()
629629

630+
def test_empty_index_for_empty_dataframe(self):
631+
empty_df = pd.DataFrame(columns=['A'])
632+
df_with_empty_value = pd.DataFrame(columns=['A'], data=[])
633+
assert df_with_empty_value.index.dtype == empty_df.index.dtype
634+
630635

631636
class TestMisc(Base):
632637

0 commit comments

Comments
 (0)