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):
10081008 # if we cannot then coerce to object
10091009 dtype , _ = infer_dtype_from (other , pandas_dtype = True )
10101010
1011- if isinstance (self .dtype , StringDtype ):
1012- dtype = StringDtype ()
1013-
10141011 if is_dtype_equal (self .dtype , dtype ):
10151012 return self
10161013
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 ):
10181022 # we don't upcast to bool
10191023 return self .astype (object )
10201024
You can’t perform that action at this time.
0 commit comments