Closed
Description
Pandas version checks
-
I have checked that this issue has not already been reported.
-
I have confirmed this bug exists on the latest version of pandas.
-
I have confirmed this bug exists on the main branch of pandas.
Reproducible Example
>>> pandas.to_datetime(["2019"])
DatetimeIndex(['2019-01-01'], dtype='datetime64[ns]', freq=None)
>>> pandas.to_datetime(["2030-01-01", "2020-01-01"])
DatetimeIndex(['2030-01-01', '2020-01-01'], dtype='datetime64[ns]', freq=None)
>>> pandas.to_datetime(["2019", "2020"])
<stdin>:1: UserWarning: Could not infer format, so each element will be parsed individually, falling back to `dateutil`. To ensure parsing is consistent and as-expected, please specify a format.
DatetimeIndex(['2019-01-01', '2020-01-01'], dtype='datetime64[ns]', freq=None)
Issue Description
List of years (as strings) provided to to_datetime
raises UserWarning. For some reason, single years and lists of dates do not trigger this warning. This is breaking tests in CI.
Expected Behavior
Expect no userwarning.
Installed Versions
N/A