File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -1008,13 +1008,17 @@ def coerce_to_target_dtype(self, other):
1008
1008
# if we cannot then coerce to object
1009
1009
dtype , _ = infer_dtype_from (other , pandas_dtype = True )
1010
1010
1011
- if isinstance (self .dtype , StringDtype ):
1012
- dtype = StringDtype ()
1013
-
1014
1011
if is_dtype_equal (self .dtype , dtype ):
1015
1012
return self
1016
1013
1017
- if self .is_bool or is_object_dtype (dtype ) or is_bool_dtype (dtype ):
1014
+ if (
1015
+ is_extension_array_dtype (self .dtype )
1016
+ and not self .is_datetime
1017
+ and not is_integer_dtype (dtype )
1018
+ ):
1019
+ dtype = self .dtype
1020
+
1021
+ elif self .is_bool or is_object_dtype (dtype ) or is_bool_dtype (dtype ):
1018
1022
# we don't upcast to bool
1019
1023
return self .astype (object )
1020
1024
You can’t perform that action at this time.
0 commit comments