Skip to content

Commit eaeb29d

Browse files
resolving broken tests
1 parent a1f9068 commit eaeb29d

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

pandas/core/construction.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -621,10 +621,19 @@ def create_series_with_explicit_dtype(
621621
-------
622622
Series
623623
"""
624+
from pandas import RangeIndex
625+
624626
if is_empty_data(data) and dtype is None:
625627
dtype = dtype_if_empty
628+
626629
return create_series_with_explicit_index_type(
627-
data=data, index=index, dtype=dtype, name=name, copy=copy, fastpath=fastpath
630+
data=data,
631+
index=index,
632+
dtype=dtype,
633+
name=name,
634+
copy=copy,
635+
fastpath=fastpath,
636+
index_if_empty=RangeIndex(0), # non-breaking yet
628637
)
629638

630639

@@ -661,10 +670,11 @@ def create_series_with_explicit_index_type(
661670
"""
662671
from pandas import Index, Series # noqa: F811
663672

673+
# to avoid circular imports
664674
if index_if_empty is None:
665675
index_if_empty = Index([])
666676

667-
if is_list_like(data) and len(data) == 0:
677+
if index is None and data == []:
668678
index = index_if_empty
669679
return Series(
670680
data=data, index=index, dtype=dtype, name=name, copy=copy, fastpath=fastpath

0 commit comments

Comments
 (0)