Skip to content

Commit f01ae20

Browse files
committed
I had a hack where I defaulted using get_supported_reso. But new pandas
also uses get_supported_reso when doing constructor with existing dtype. This is missing things up. Only run the conversion if dtype is not good. This only matters for [s]
1 parent 156620e commit f01ae20

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pandas/core/construction.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,11 @@ def ensure_wrapped_if_datetimelike(arr):
486486
if arr.dtype.kind == "M":
487487
from pandas.core.arrays import DatetimeArray
488488

489-
dtype = get_supported_dtype(arr.dtype)
489+
dtype = arr.dtype
490+
# get_supported_type is hacked to return [ms] instead of [s]
491+
# I dont want this to change.
492+
if not is_supported_dtype(dtype):
493+
dtype = get_supported_dtype(dtype)
490494
return DatetimeArray._from_sequence(arr, dtype=dtype)
491495

492496
elif arr.dtype.kind == "m":

0 commit comments

Comments
 (0)