File tree Expand file tree Collapse file tree 1 file changed +3
-5
lines changed Expand file tree Collapse file tree 1 file changed +3
-5
lines changed Original file line number Diff line number Diff line change @@ -1010,11 +1010,7 @@ def coerce_to_target_dtype(self, other):
10101010 if is_dtype_equal (self .dtype , dtype ):
10111011 return self
10121012
1013- if (
1014- is_extension_array_dtype (self .dtype )
1015- and not is_categorical_dtype (self .dtype )
1016- and not self .is_datetime
1017- ):
1013+ if is_extension_array_dtype (self .dtype ) and not is_categorical_dtype (self .dtype ):
10181014 dtype = self .dtype
10191015
10201016 elif self .is_bool or is_object_dtype (dtype ) or is_bool_dtype (dtype ):
@@ -1060,6 +1056,8 @@ def coerce_to_target_dtype(self, other):
10601056 raise AssertionError (
10611057 f"possible recursion in coerce_to_target_dtype: { self } { other } "
10621058 )
1059+ if is_categorical_dtype (dtype ) or self .is_datetime :
1060+ return self .astype (object )
10631061
10641062 try :
10651063 return self .astype (dtype )
You can’t perform that action at this time.
0 commit comments