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
import pandas as pd
...
# using both 05 and 95 data on 'YEAR' is not supported
pd.to_datetime(df[['YEAR', 'MONTH', 'DAY']], format="%y%m%d")
Issue Description
Python support %y
as shown in https://docs.python.org/3/library/datetime.html#strftime-and-strptime-format-codes
But, using format="%y%m%d"
, error occurs:
ValueError: time data "950101" doesn't match format "%Y%m%d", at position 0. You might want to try:
- passing `format` if your strings have a consistent format;
- passing `format='ISO8601'` if your strings are all ISO8601 but not necessarily in exactly the same format;
- passing `format='mixed'`, and the format will be inferred for each element individually. You might want to use `dayfirst` alongside this.
Expected Behavior
Pandas should also support %y
Installed Versions
2.0.3