Skip to content

Commit 5104bed

Browse files
committed
revert pandas/_libs/tslib.pyx
1 parent 77fb53a commit 5104bed

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

pandas/_libs/tslib.pyx

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,7 @@ def array_with_unit_to_datetime(
227227
m = cast_from_unit(None, unit)
228228

229229
if is_raise:
230+
230231
# try a quick conversion to i8
231232
# if we have nulls that are not type-compat
232233
# then need to iterate
@@ -239,17 +240,9 @@ def array_with_unit_to_datetime(
239240
fvalues = iresult.astype('f8') * m
240241
need_to_iterate = False
241242

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-
251243
# check the bounds
252244
if not need_to_iterate:
245+
253246
if ((fvalues < Timestamp.min.value).any()
254247
or (fvalues > Timestamp.max.value).any()):
255248
raise OutOfBoundsDatetime(f"cannot convert input with unit '{unit}'")
@@ -417,6 +410,7 @@ cpdef array_to_datetime(
417410
float offset_seconds, tz_offset
418411
set out_tzoffset_vals = set()
419412
bint string_to_dts_failed
413+
420414
# specify error conditions
421415
assert is_raise or is_ignore or is_coerce
422416

0 commit comments

Comments
 (0)