Skip to content

Commit aa9d424

Browse files
author
MarcoGorelli
committed
wait, we can remove require_iso8601 now? neeeeeeaat
1 parent 3283b81 commit aa9d424

File tree

3 files changed

+0
-43
lines changed

3 files changed

+0
-43
lines changed

pandas/_libs/tslib.pyi

-3
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@ def array_to_datetime(
2323
dayfirst: bool = ...,
2424
yearfirst: bool = ...,
2525
utc: bool = ...,
26-
require_iso8601: bool = ...,
27-
format: str | None = ...,
28-
exact: bool = ...,
2926
) -> tuple[np.ndarray, tzinfo | None]: ...
3027

3128
# returned ndarray may be object dtype or datetime64[ns]

pandas/_libs/tslib.pyx

-37
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,6 @@ cpdef array_to_datetime(
409409
bint dayfirst=False,
410410
bint yearfirst=False,
411411
bint utc=False,
412-
bint require_iso8601=False,
413412
):
414413
"""
415414
Converts a 1D array of date-like values to a numpy array of either:
@@ -436,8 +435,6 @@ cpdef array_to_datetime(
436435
yearfirst parsing behavior when encountering datetime strings
437436
utc : bool, default False
438437
indicator whether the dates should be UTC
439-
require_iso8601 : bool, default False
440-
indicator whether the datetime string should be iso8601
441438
442439
Returns
443440
-------
@@ -508,16 +505,6 @@ cpdef array_to_datetime(
508505
iresult[i] = get_datetime64_nanos(val, NPY_FR_ns)
509506

510507
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
521508
# these must be ns unit by-definition
522509
seen_integer = True
523510

@@ -555,18 +542,6 @@ cpdef array_to_datetime(
555542
# specifically _not_ OutOfBoundsDatetime
556543
if _parse_today_now(val, &iresult[i], utc):
557544
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
570545

571546
try:
572547
py_dt = parse_datetime_string(val,
@@ -629,18 +604,6 @@ cpdef array_to_datetime(
629604
if is_coerce:
630605
iresult[i] = NPY_NAT
631606
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
644607
raise
645608

646609
except OutOfBoundsDatetime:

pandas/core/arrays/datetimes.py

-3
Original file line numberDiff line numberDiff line change
@@ -2118,7 +2118,6 @@ def objects_to_datetime64ns(
21182118
yearfirst,
21192119
utc: bool = False,
21202120
errors: DateTimeErrorChoices = "raise",
2121-
require_iso8601: bool = False,
21222121
allow_object: bool = False,
21232122
):
21242123
"""
@@ -2132,7 +2131,6 @@ def objects_to_datetime64ns(
21322131
utc : bool, default False
21332132
Whether to convert/localize timestamps to UTC.
21342133
errors : {'raise', 'ignore', 'coerce'}
2135-
require_iso8601 : bool, default False
21362134
allow_object : bool
21372135
Whether to return an object-dtype ndarray instead of raising if the
21382136
data contains more than one timezone.
@@ -2163,7 +2161,6 @@ def objects_to_datetime64ns(
21632161
utc=utc,
21642162
dayfirst=dayfirst,
21652163
yearfirst=yearfirst,
2166-
require_iso8601=require_iso8601,
21672164
)
21682165
result = result.reshape(data.shape, order=order)
21692166
except OverflowError as err:

0 commit comments

Comments
 (0)