Skip to content

Commit 1d50e6e

Browse files
author
MarcoGorelli
committed
wip
1 parent b63d35d commit 1d50e6e

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

pandas/core/tools/datetimes.py

+8-7
Original file line numberDiff line numberDiff line change
@@ -139,13 +139,14 @@ def _guess_datetime_format_for_array(arr, dayfirst: bool | None = False) -> str
139139
)
140140
if guessed_format is not None:
141141
return guessed_format
142-
warnings.warn(
143-
"Could not infer format, so each element will be parsed "
144-
"individually, falling back to `dateutil`. To ensure parsing is "
145-
"consistent and as-expected, please specify a format.",
146-
UserWarning,
147-
stacklevel=find_stack_level(),
148-
)
142+
if tslib.first_non_null(arr[first_non_null + 1 :]) != -1:
143+
warnings.warn(
144+
"Could not infer format, so each element will be parsed "
145+
"individually, falling back to `dateutil`. To ensure parsing is "
146+
"consistent and as-expected, please specify a format.",
147+
UserWarning,
148+
stacklevel=find_stack_level(),
149+
)
149150
return None
150151

151152

0 commit comments

Comments
 (0)