Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions pandas/core/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,8 @@ def __init__(self, data=None, index=None, dtype=None, name=None,

if data is None:
data = {}
if index is None:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needs a test

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should I add the test code in the following test? Or somewhere else?
Is setting check_index_type=True enough?

def test_constructor_empty(self): empty = Series() empty2 = Series([]) # the are Index() and RangeIndex() which don't compare type equal # but are just .equals assert_series_equal(empty, empty2, check_index_type=False) empty = Series(index=lrange(10)) empty2 = Series(np.nan, index=lrange(10)) assert_series_equal(empty, empty2)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you prob just need to remove the check_index_type=False and then your change should work

index = _default_index(0)
if dtype is not None:
dtype = self._validate_dtype(dtype)

Expand Down