Skip to content

Commit c74a4d0

Browse files
committed
cleanup
1 parent 1d2eee1 commit c74a4d0

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

pandas/core/arrays/datetimes.py

+5-8
Original file line numberDiff line numberDiff line change
@@ -2211,10 +2211,8 @@ def _sequence_to_dt64(
22112211
data_dtype = getattr(data, "dtype", None)
22122212

22132213
out_dtype = DT64NS_DTYPE
2214-
out_reso = abbrev_to_npy_unit(None) # NPY_FR_GENERIC
22152214
if out_unit is not None:
22162215
out_dtype = np.dtype(f"M8[{out_unit}]")
2217-
out_reso = abbrev_to_npy_unit(out_unit)
22182216

22192217
if data_dtype == object or is_string_dtype(data_dtype):
22202218
# TODO: We do not have tests specific to string-dtypes,
@@ -2239,7 +2237,7 @@ def _sequence_to_dt64(
22392237
dayfirst=dayfirst,
22402238
yearfirst=yearfirst,
22412239
allow_object=False,
2242-
out_reso=out_reso,
2240+
out_unit=out_unit,
22432241
)
22442242
copy = False
22452243
if tz and inferred_tz:
@@ -2350,7 +2348,7 @@ def objects_to_datetime64(
23502348
utc: bool = False,
23512349
errors: DateTimeErrorChoices = "raise",
23522350
allow_object: bool = False,
2353-
out_reso: int = 14,
2351+
out_unit: str | None = None,
23542352
):
23552353
"""
23562354
Convert data to array of timestamps.
@@ -2366,9 +2364,8 @@ def objects_to_datetime64(
23662364
allow_object : bool
23672365
Whether to return an object-dtype ndarray instead of raising if the
23682366
data contains more than one timezone.
2369-
out_reso : int, default 14
2370-
14 corresponds to NPY_FR_GENERIC, which indicates to infer
2371-
a resolution.
2367+
out_unit : str or None, default None
2368+
None indicates we should do resolution inference.
23722369
23732370
Returns
23742371
-------
@@ -2394,7 +2391,7 @@ def objects_to_datetime64(
23942391
utc=utc,
23952392
dayfirst=dayfirst,
23962393
yearfirst=yearfirst,
2397-
creso=out_reso,
2394+
creso=abbrev_to_npy_unit(out_unit),
23982395
)
23992396

24002397
if tz_parsed is not None:

0 commit comments

Comments
 (0)