Skip to content

Commit b5e4640

Browse files
committed
CLN: incorporate final comments
1 parent 83081ea commit b5e4640

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

pandas/_libs/tslib.pyx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -296,8 +296,8 @@ def format_array_from_datetime(ndarray[int64_t] values, object tz=None,
296296
return result
297297

298298

299-
def array_with_unit_to_datetime(ndarray values, object unit,
300-
str errors='coerce', ndarray mask=None):
299+
def array_with_unit_to_datetime(ndarray values, ndarray mask, object unit,
300+
str errors='coerce'):
301301
"""
302302
Convert the ndarray to datetime according to the time unit.
303303
@@ -316,10 +316,10 @@ def array_with_unit_to_datetime(ndarray values, object unit,
316316
----------
317317
values : ndarray of object
318318
Date-like objects to convert
319-
unit : object
320-
Time unit to use during conversion
321319
mask : ndarray of bool, default None
322320
Not-a-time mask for non-nullable integer types conversion
321+
unit : object
322+
Time unit to use during conversion
323323
errors : str, default 'raise'
324324
Error behavior when parsing
325325

pandas/core/tools/datetimes.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -318,19 +318,20 @@ def _convert_listlike_datetimes(
318318
if format is not None:
319319
raise ValueError("cannot specify both format and unit")
320320
arg = getattr(arg, "_values", arg)
321+
321322
# GH 30050 pass an ndarray to tslib.array_with_unit_to_datetime
322323
# because it expects an ndarray argument
323324
if isinstance(arg, IntegerArray):
324325
# Explicitly pass NaT mask to array_with_unit_to_datetime
325-
mask_na = arg.isna()
326+
mask = arg.isna()
326327
arg = getattr(arg, "_ndarray_values", arg)
327-
result, tz_parsed = tslib.array_with_unit_to_datetime(
328-
arg, unit, mask=mask_na, errors=errors
329-
)
330328
else:
331-
result, tz_parsed = tslib.array_with_unit_to_datetime(
332-
arg, unit, errors=errors
333-
)
329+
mask = None
330+
331+
result, tz_parsed = tslib.array_with_unit_to_datetime(
332+
arg, mask, unit, errors=errors
333+
)
334+
334335
if errors == "ignore":
335336
from pandas import Index
336337

0 commit comments

Comments
 (0)