-
-
Notifications
You must be signed in to change notification settings - Fork 18.7k
Closed
Labels
DatetimeDatetime data dtypeDatetime data dtypePerformanceMemory or execution speed performanceMemory or execution speed performancegood first issue
Description
Suggested here: #50242 (comment)
Here are the relevant lines of code:
pandas/pandas/_libs/tslibs/parsing.pyx
Lines 821 to 838 in 4e88c3f
def format_is_iso(f: str) -> bint: | |
""" | |
Does format match the iso8601 set that can be handled by the C parser? | |
Generally of form YYYY-MM-DDTHH:MM:SS - date separator can be different | |
but must be consistent. Leading 0s in dates and times are optional. | |
""" | |
iso_template = "%Y{date_sep}%m{date_sep}%d{time_sep}%H:%M:%S{micro_or_tz}".format | |
excluded_formats = ["%Y%m%d", "%Y%m", "%Y"] | |
for date_sep in [" ", "/", "\\", "-", ".", ""]: | |
for time_sep in [" ", "T"]: | |
for micro_or_tz in ["", "%z", ".%f", ".%f%z"]: | |
if (iso_template(date_sep=date_sep, | |
time_sep=time_sep, | |
micro_or_tz=micro_or_tz, | |
).startswith(f) and f not in excluded_formats): | |
return True | |
return False |
Metadata
Metadata
Assignees
Labels
DatetimeDatetime data dtypeDatetime data dtypePerformanceMemory or execution speed performanceMemory or execution speed performancegood first issue