Skip to content

Commit

Permalink
Added test for ensuring empty df has an empty index.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sumanau Sareen committed May 20, 2019
1 parent f6efb8d commit 6f545b8
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pandas/tests/indexing/test_indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,11 @@ def test_index_type_coercion(self):
idxr(s2)['0'] = 0
assert s2.index.is_object()

def test_empty_index_for_empty_dataframe(self):
empty_df = pd.DataFrame(columns=['A'])
df_with_empty_value = pd.DataFrame(columns=['A'], data=[])
assert df_with_empty_value.index.dtype == empty_df.index.dtype


class TestMisc(Base):

Expand Down

0 comments on commit 6f545b8

Please sign in to comment.