Skip to content

Commit 089a72a

Browse files
committed
fix for infering dtype in failing s.combine on extention array
1 parent 96fa493 commit 089a72a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pandas/core/series.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
from pandas.util._decorators import Appender, Substitution, deprecate
1919
from pandas.util._validators import validate_bool_kwarg
2020

21+
from pandas.core.dtypes.cast import infer_dtype_from
2122
from pandas.core.dtypes.common import (
2223
_is_unorderable_exception, ensure_platform_int, is_bool,
2324
is_categorical_dtype, is_datetime64_dtype, is_datetimelike, is_dict_like,
@@ -2648,7 +2649,10 @@ def combine(self, other, func, fill_value=None):
26482649
# The function can return something of any type, so check
26492650
# if the type is compatible with the calling EA.
26502651
non_na_values = [v for v in new_values if notna(v)]
2651-
new_dtype, _ = infer_dtype_from(non_na_values, pandas_dtype=True)
2652+
if non_na_values:
2653+
new_dtype, _ = infer_dtype_from(non_na_values, pandas_dtype=True)
2654+
else:
2655+
new_dtype = self.dtype
26522656
try:
26532657
new_values = self._values._from_sequence(new_values, dtype=new_dtype)
26542658
except Exception:

0 commit comments

Comments
 (0)