File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -227,7 +227,6 @@ def array_with_unit_to_datetime(
227
227
m = cast_from_unit(None , unit)
228
228
229
229
if is_raise:
230
-
231
230
# try a quick conversion to i8
232
231
# if we have nulls that are not type-compat
233
232
# then need to iterate
@@ -240,9 +239,17 @@ def array_with_unit_to_datetime(
240
239
fvalues = iresult.astype(' f8' ) * m
241
240
need_to_iterate = False
242
241
242
+ # GH20445
243
+ if values.dtype.kind == " f" :
244
+ fresult = values.astype(' f8' , casting = ' same_kind' , copy = False )
245
+ # fill by comparing to NPY_NAT constant
246
+ mask = fresult == NPY_NAT
247
+ fresult[mask] = 0.0
248
+ fvalues = fvalues.astype(' f8' ) * m # FIXME: this line segfaults rn
249
+ need_to_iterate = False
250
+
243
251
# check the bounds
244
252
if not need_to_iterate:
245
-
246
253
if ((fvalues < Timestamp.min.value).any()
247
254
or (fvalues > Timestamp.max.value).any()):
248
255
raise OutOfBoundsDatetime(f" cannot convert input with unit '{unit}'" )
@@ -410,7 +417,6 @@ cpdef array_to_datetime(
410
417
float offset_seconds, tz_offset
411
418
set out_tzoffset_vals = set ()
412
419
bint string_to_dts_failed
413
-
414
420
# specify error conditions
415
421
assert is_raise or is_ignore or is_coerce
416
422
You can’t perform that action at this time.
0 commit comments