File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change 53
53
is_datetime64_dtype ,
54
54
is_datetime64_ns_dtype ,
55
55
is_datetime64tz_dtype ,
56
+ is_datetime_or_timedelta_any_dtype ,
56
57
is_datetime_or_timedelta_dtype ,
57
58
is_dtype_equal ,
58
59
is_extension_array_dtype ,
@@ -175,9 +176,9 @@ def maybe_downcast_to_dtype(result, dtype: Dtype):
175
176
return converted
176
177
177
178
# a datetimelike
178
- # GH12821, iNaT is casted to float
179
- if dtype . kind in [ "M" , "m" ] and result .dtype .kind in ["i" , "f" ]:
180
- if hasattr (dtype , "tz" ):
179
+ # GH12821, iNaT is cast to float
180
+ if is_datetime_or_timedelta_any_dtype ( dtype ) and result .dtype .kind in ["i" , "f" ]:
181
+ if not is_datetime_or_timedelta_dtype (dtype ):
181
182
# not a numpy dtype
182
183
if dtype .tz :
183
184
# convert to datetime and change timezone
You can’t perform that action at this time.
0 commit comments