@@ -409,7 +409,6 @@ cpdef array_to_datetime(
409
409
bint dayfirst = False ,
410
410
bint yearfirst = False ,
411
411
bint utc = False ,
412
- bint require_iso8601 = False ,
413
412
):
414
413
"""
415
414
Converts a 1D array of date-like values to a numpy array of either:
@@ -436,8 +435,6 @@ cpdef array_to_datetime(
436
435
yearfirst parsing behavior when encountering datetime strings
437
436
utc : bool, default False
438
437
indicator whether the dates should be UTC
439
- require_iso8601 : bool, default False
440
- indicator whether the datetime string should be iso8601
441
438
442
439
Returns
443
440
-------
@@ -508,16 +505,6 @@ cpdef array_to_datetime(
508
505
iresult[i] = get_datetime64_nanos(val, NPY_FR_ns)
509
506
510
507
elif is_integer_object(val) or is_float_object(val):
511
- if require_iso8601:
512
- if is_coerce:
513
- iresult[i] = NPY_NAT
514
- continue
515
- elif is_raise:
516
- raise ValueError (
517
- f" time data \" {val}\" at position {i} doesn't "
518
- f" match ISO8601 standard"
519
- )
520
- return values, tz_out
521
508
# these must be ns unit by-definition
522
509
seen_integer = True
523
510
@@ -555,18 +542,6 @@ cpdef array_to_datetime(
555
542
# specifically _not_ OutOfBoundsDatetime
556
543
if _parse_today_now(val, & iresult[i], utc):
557
544
continue
558
- elif require_iso8601:
559
- # if requiring iso8601 strings, skip trying
560
- # other formats
561
- if is_coerce:
562
- iresult[i] = NPY_NAT
563
- continue
564
- elif is_raise:
565
- raise ValueError (
566
- f" time data \" {val}\" at position {i} doesn't "
567
- f" match format \" {format}\" "
568
- )
569
- return values, tz_out
570
545
571
546
try :
572
547
py_dt = parse_datetime_string(val,
@@ -629,18 +604,6 @@ cpdef array_to_datetime(
629
604
if is_coerce:
630
605
iresult[i] = NPY_NAT
631
606
continue
632
- elif require_iso8601 and isinstance (val, str ):
633
- # GH#19382 for just-barely-OutOfBounds falling back to
634
- # dateutil parser will return incorrect result because
635
- # it will ignore nanoseconds
636
- if is_raise:
637
-
638
- # Still raise OutOfBoundsDatetime,
639
- # as error message is informative.
640
- raise
641
-
642
- assert is_ignore
643
- return values, tz_out
644
607
raise
645
608
646
609
except OutOfBoundsDatetime:
0 commit comments