File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change 1919
2020import numpy as np
2121
22- from pandas ._config import get_option
22+ from pandas ._config import (
23+ get_option ,
24+ using_string_dtype ,
25+ )
2326
2427from pandas ._libs import (
2528 NaT ,
@@ -6233,8 +6236,16 @@ def _find_common_type_compat(self, target) -> DtypeObj:
62336236 Implementation of find_common_type that adjusts for Index-specific
62346237 special cases.
62356238 """
6239+ # breakpoint()
62366240 target_dtype , _ = infer_dtype_from (target )
62376241
6242+ if using_string_dtype ():
6243+ from pandas .core .indexes .range import RangeIndex
6244+
6245+ if len (self ) == 0 or self .isna ().all ():
6246+ if isinstance (self , RangeIndex ) or self .dtype == np .object_ :
6247+ return target_dtype
6248+
62386249 # special case: if one dtype is uint64 and the other a signed int, return object
62396250 # See https://github.com/pandas-dev/pandas/issues/26778 for discussion
62406251 # Now it's:
You can’t perform that action at this time.
0 commit comments