Skip to content

Commit e1e5e52

Browse files
committed
cleanup
1 parent 40eb111 commit e1e5e52

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,
@@ -2240,7 +2238,7 @@ def _sequence_to_dt64(
22402238
dayfirst=dayfirst,
22412239
yearfirst=yearfirst,
22422240
allow_object=False,
2243-
out_reso=out_reso,
2241+
out_unit=out_unit,
22442242
)
22452243
copy = False
22462244
if tz and inferred_tz:
@@ -2351,7 +2349,7 @@ def objects_to_datetime64(
23512349
utc: bool = False,
23522350
errors: DateTimeErrorChoices = "raise",
23532351
allow_object: bool = False,
2354-
out_reso: int = 14,
2352+
out_unit: str | None = None,
23552353
):
23562354
"""
23572355
Convert data to array of timestamps.
@@ -2367,9 +2365,8 @@ def objects_to_datetime64(
23672365
allow_object : bool
23682366
Whether to return an object-dtype ndarray instead of raising if the
23692367
data contains more than one timezone.
2370-
out_reso : int, default 14
2371-
14 corresponds to NPY_FR_GENERIC, which indicates to infer
2372-
a resolution.
2368+
out_unit : str or None, default None
2369+
None indicates we should do resolution inference.
23732370
23742371
Returns
23752372
-------
@@ -2395,7 +2392,7 @@ def objects_to_datetime64(
23952392
utc=utc,
23962393
dayfirst=dayfirst,
23972394
yearfirst=yearfirst,
2398-
creso=out_reso,
2395+
creso=abbrev_to_npy_unit(out_unit),
23992396
)
24002397

24012398
if tz_parsed is not None:

0 commit comments

Comments
 (0)