File tree 1 file changed +9
-3
lines changed
1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -234,7 +234,6 @@ def array_with_unit_to_datetime(
234
234
m = cast_from_unit(None , unit)
235
235
236
236
if is_raise:
237
-
238
237
# try a quick conversion to i8
239
238
# if we have nulls that are not type-compat
240
239
# then need to iterate
@@ -247,9 +246,17 @@ def array_with_unit_to_datetime(
247
246
fvalues = iresult.astype(' f8' ) * m
248
247
need_to_iterate = False
249
248
249
+ # GH20445
250
+ if values.dtype.kind == " f" :
251
+ fresult = values.astype(' f8' , casting = ' same_kind' , copy = False )
252
+ # fill by comparing to NPY_NAT constant
253
+ mask = fresult == NPY_NAT
254
+ fresult[mask] = 0.0
255
+ fvalues = fvalues.astype(' f8' ) * m # FIXME: this line segfaults rn
256
+ need_to_iterate = False
257
+
250
258
# check the bounds
251
259
if not need_to_iterate:
252
-
253
260
if ((fvalues < Timestamp.min.value).any()
254
261
or (fvalues > Timestamp.max.value).any()):
255
262
raise OutOfBoundsDatetime(f" cannot convert input with unit '{unit}'" )
@@ -417,7 +424,6 @@ cpdef array_to_datetime(
417
424
float offset_seconds, tz_offset
418
425
set out_tzoffset_vals = set ()
419
426
bint string_to_dts_failed
420
-
421
427
# specify error conditions
422
428
assert is_raise or is_ignore or is_coerce
423
429
You can’t perform that action at this time.
0 commit comments