File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -1130,7 +1130,10 @@ def coerce_to_target_dtype(self, other):
1130
1130
if is_dtype_equal (self .dtype , dtype ):
1131
1131
return self
1132
1132
1133
- if self .is_bool or is_object_dtype (dtype ) or is_bool_dtype (dtype ):
1133
+ if is_extension_array_dtype (self .dtype ) and not is_categorical_dtype (dtype ):
1134
+ dtype = self .dtype
1135
+
1136
+ elif self .is_bool or is_object_dtype (dtype ) or is_bool_dtype (dtype ):
1134
1137
# we don't upcast to bool
1135
1138
return self .astype (object )
1136
1139
@@ -1174,6 +1177,9 @@ def coerce_to_target_dtype(self, other):
1174
1177
f"possible recursion in coerce_to_target_dtype: { self } { other } "
1175
1178
)
1176
1179
1180
+ if is_categorical_dtype (dtype ) or self .is_datetime :
1181
+ return self .astype (object )
1182
+
1177
1183
try :
1178
1184
return self .astype (dtype )
1179
1185
except (ValueError , TypeError , OverflowError ):
You can’t perform that action at this time.
0 commit comments