File tree Expand file tree Collapse file tree 1 file changed +5
-11
lines changed Expand file tree Collapse file tree 1 file changed +5
-11
lines changed Original file line number Diff line number Diff line change 88
88
ABCSeries ,
89
89
)
90
90
from pandas .core .dtypes .inference import is_list_like
91
- from pandas .core .dtypes .missing import (
92
- is_valid_nat_for_dtype ,
93
- isna ,
94
- na_value_for_dtype ,
95
- notna ,
96
- )
91
+ from pandas .core .dtypes .missing import isna , na_value_for_dtype , notna
97
92
98
93
if TYPE_CHECKING :
99
94
from pandas import Series
@@ -1697,11 +1692,10 @@ def construct_1d_arraylike_from_scalar(
1697
1692
dtype = np .dtype ("object" )
1698
1693
if not isna (value ):
1699
1694
value = ensure_str (value )
1700
- elif dtype .kind in ["M" , "m" ] and is_valid_nat_for_dtype (value , dtype ):
1701
- # GH36541: can't fill array directly with pd.NaT
1702
- # > np.empty(10, dtype="datetime64[64]").fill(pd.NaT)
1703
- # ValueError: cannot convert float NaN to integer
1704
- value = np .datetime64 ("NaT" )
1695
+ elif dtype .kind in ["M" , "m" ]:
1696
+ # GH36541: can't fill array directly with pd.NaT -> ValueError
1697
+ # GH38032: filling in pd.Timedelta loses nanoseconds
1698
+ value = convert_scalar_for_putitemlike (value , dtype )
1705
1699
1706
1700
subarr = np .empty (length , dtype = dtype )
1707
1701
subarr .fill (value )
You can’t perform that action at this time.
0 commit comments