@@ -338,7 +338,7 @@ def array_with_unit_to_datetime(
338
338
f" unit='{unit}' not valid with non-numerical val='{val}'"
339
339
)
340
340
341
- except (ValueError , OutOfBoundsDatetime, TypeError ) as err:
341
+ except (ValueError , TypeError ) as err:
342
342
if is_raise:
343
343
err.args = (f" {err}, at position {i}" ,)
344
344
raise
@@ -435,15 +435,15 @@ cpdef array_to_datetime(
435
435
Parameters
436
436
----------
437
437
values : ndarray of object
438
- date-like objects to convert
438
+ date-like objects to convert
439
439
errors : str, default 'raise'
440
- error behavior when parsing
440
+ error behavior when parsing
441
441
dayfirst : bool, default False
442
- dayfirst parsing behavior when encountering datetime strings
442
+ dayfirst parsing behavior when encountering datetime strings
443
443
yearfirst : bool, default False
444
- yearfirst parsing behavior when encountering datetime strings
444
+ yearfirst parsing behavior when encountering datetime strings
445
445
utc : bool, default False
446
- indicator whether the dates should be UTC
446
+ indicator whether the dates should be UTC
447
447
creso : NPY_DATETIMEUNIT, default NPY_FR_ns
448
448
Set to NPY_FR_GENERIC to infer a resolution.
449
449
@@ -464,7 +464,7 @@ cpdef array_to_datetime(
464
464
bint is_ignore = errors == " ignore"
465
465
bint is_coerce = errors == " coerce"
466
466
bint is_same_offsets
467
- _TSObject _ts
467
+ _TSObject tsobj
468
468
float tz_offset
469
469
set out_tzoffset_vals = set ()
470
470
tzinfo tz, tz_out = None
@@ -550,29 +550,28 @@ cpdef array_to_datetime(
550
550
creso = state.creso
551
551
continue
552
552
553
- _ts = convert_str_to_tsobject(
553
+ tsobj = convert_str_to_tsobject(
554
554
val, None , dayfirst = dayfirst, yearfirst = yearfirst
555
555
)
556
556
557
- if _ts .value == NPY_NAT:
557
+ if tsobj .value == NPY_NAT:
558
558
# e.g. "NaT" string or empty string, we do not consider
559
559
# this as either tzaware or tznaive. See
560
560
# test_to_datetime_with_empty_str_utc_false_format_mixed
561
561
# We also do not update resolution inference based on this,
562
562
# see test_infer_with_nat_int_float_str
563
- iresult[i] = _ts .value
563
+ iresult[i] = tsobj .value
564
564
continue
565
565
566
- item_reso = _ts .creso
566
+ item_reso = tsobj .creso
567
567
state.update_creso(item_reso)
568
568
if infer_reso:
569
569
creso = state.creso
570
570
571
- _ts.ensure_reso(creso, val)
572
-
573
- iresult[i] = _ts.value
571
+ tsobj.ensure_reso(creso, val)
572
+ iresult[i] = tsobj.value
574
573
575
- tz = _ts .tzinfo
574
+ tz = tsobj .tzinfo
576
575
if tz is not None :
577
576
# dateutil timezone objects cannot be hashed, so
578
577
# store the UTC offsets in seconds instead
0 commit comments