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 19
19
20
20
import numpy as np
21
21
22
- from pandas ._config import get_option
22
+ from pandas ._config import (
23
+ get_option ,
24
+ using_string_dtype ,
25
+ )
23
26
24
27
from pandas ._libs import (
25
28
NaT ,
@@ -6233,8 +6236,16 @@ def _find_common_type_compat(self, target) -> DtypeObj:
6233
6236
Implementation of find_common_type that adjusts for Index-specific
6234
6237
special cases.
6235
6238
"""
6239
+ # breakpoint()
6236
6240
target_dtype , _ = infer_dtype_from (target )
6237
6241
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
+
6238
6249
# special case: if one dtype is uint64 and the other a signed int, return object
6239
6250
# See https://github.com/pandas-dev/pandas/issues/26778 for discussion
6240
6251
# Now it's:
You can’t perform that action at this time.
0 commit comments