Skip to content

Commit 1700cae

Browse files
committed
Try avoiding compiler warning
1 parent 192dba6 commit 1700cae

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

pandas/_libs/tslibs/conversion.pyx

+8-8
Original file line numberDiff line numberDiff line change
@@ -149,18 +149,18 @@ def cast_from_unit_vectorized(
149149
if p:
150150
frac = np.round(frac, p)
151151

152-
try:
153-
for i in range(len(values)):
152+
for i in range(len(values)):
153+
try:
154154
if base[i] == NPY_NAT:
155155
out[i] = NPY_NAT
156156
else:
157157
out[i] = <int64_t>(base[i] * m) + <int64_t>(frac[i] * m)
158-
except (OverflowError, FloatingPointError) as err:
159-
# FloatingPointError can be issued if we have float dtype and have
160-
# set np.errstate(over="raise")
161-
raise OutOfBoundsDatetime(
162-
f"cannot convert input {values[i]} with the unit '{unit}'"
163-
) from err
158+
except (OverflowError, FloatingPointError) as err:
159+
# FloatingPointError can be issued if we have float dtype and have
160+
# set np.errstate(over="raise")
161+
raise OutOfBoundsDatetime(
162+
f"cannot convert input {values[i]} with the unit '{unit}'"
163+
) from err
164164
return out
165165

166166

0 commit comments

Comments
 (0)