Skip to content

Commit 69d3c66

Browse files
committed
post-merge fixups
1 parent e9f4a4f commit 69d3c66

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

pandas/_libs/tslibs/strptime.pyx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ def array_strptime(
469469
ival, tz, ambiguous="raise", nonexistent=None, creso=creso
470470
)
471471
nsecs = (ival - iresult[i])
472-
if creso == NPY_FR_ns:
472+
if creso == NPY_DATETIMEUNIT.NPY_FR_ns:
473473
nsecs = nsecs // 10**9
474474
elif creso == NPY_DATETIMEUNIT.NPY_FR_us:
475475
nsecs = nsecs // 10**6
@@ -880,7 +880,7 @@ def _array_strptime_object_fallback(
880880
result[i] = ts
881881
continue
882882

883-
if parse_today_now(val, &iresult, utc, NPY_FR_ns):
883+
if parse_today_now(val, &iresult, utc, NPY_DATETIMEUNIT.NPY_FR_ns):
884884
result[i] = Timestamp(val)
885885
continue
886886

pandas/core/tools/datetimes.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -467,13 +467,15 @@ def _array_strptime_with_fallback(
467467
"""
468468
result, tz_out = array_strptime(arg, fmt, exact=exact, errors=errors, utc=utc)
469469
if tz_out is not None:
470-
dtype = DatetimeTZDtype(tz=tz_out)
470+
unit = np.datetime_data(result.dtype)[0]
471+
dtype = DatetimeTZDtype(tz=tz_out, unit=unit)
471472
dta = DatetimeArray._simple_new(result, dtype=dtype)
472473
if utc:
473474
dta = dta.tz_convert("UTC")
474475
return Index(dta, name=name)
475476
elif result.dtype != object and utc:
476-
res = Index(result, dtype="M8[ns, UTC]", name=name)
477+
unit = np.datetime_data(result.dtype)[0]
478+
res = Index(result, dtype=f"M8[{unit}, UTC]", name=name)
477479
return res
478480
return Index(result, dtype=result.dtype, name=name)
479481

0 commit comments

Comments
 (0)