We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
In [14]: to_datetime(['2000-01-01', 'now'], format='%Y-%m-%d', utc=True) Out[14]: DatetimeIndex(['2000-01-01 00:00:00+00:00', '2022-12-20 12:04:20.955180+00:00'], dtype='datetime64[ns, UTC]', freq=None) In [15]: to_datetime(['2000-01-01', 'now'], format='%Y-%d-%m', utc=True) --------------------------------------------------------------------------- ValueError Traceback (most recent call last) Cell In [15], line 1 ----> 1 to_datetime(['2000-01-01', 'now'], format='%Y-%d-%m', utc=True) File ~/tmp/.venv/lib/python3.8/site-packages/pandas/core/tools/datetimes.py:1100, in to_datetime(arg, errors, dayfirst, yearfirst, utc, format, exact, unit, infer_datetime_format, origin, cache) 1098 result = _convert_and_box_cache(argc, cache_array) 1099 else: -> 1100 result = convert_listlike(argc, format) 1101 else: 1102 result = convert_listlike(np.array([arg]), format)[0] File ~/tmp/.venv/lib/python3.8/site-packages/pandas/core/tools/datetimes.py:430, in _convert_listlike_datetimes(arg, format, name, tz, unit, errors, infer_datetime_format, dayfirst, yearfirst, exact) 427 format = None 429 if format is not None: --> 430 res = _to_datetime_with_format( 431 arg, orig_arg, name, tz, format, exact, errors, infer_datetime_format 432 ) 433 if res is not None: 434 return res File ~/tmp/.venv/lib/python3.8/site-packages/pandas/core/tools/datetimes.py:538, in _to_datetime_with_format(arg, orig_arg, name, tz, fmt, exact, errors, infer_datetime_format) 535 return _box_as_indexlike(result, utc=utc, name=name) 537 # fallback --> 538 res = _array_strptime_with_fallback( 539 arg, name, tz, fmt, exact, errors, infer_datetime_format 540 ) 541 return res File ~/tmp/.venv/lib/python3.8/site-packages/pandas/core/tools/datetimes.py:473, in _array_strptime_with_fallback(arg, name, tz, fmt, exact, errors, infer_datetime_format) 470 utc = tz == "utc" 472 try: --> 473 result, timezones = array_strptime(arg, fmt, exact=exact, errors=errors) 474 except OutOfBoundsDatetime: 475 if errors == "raise": File ~/tmp/.venv/lib/python3.8/site-packages/pandas/_libs/tslibs/strptime.pyx:150, in pandas._libs.tslibs.strptime.array_strptime() ValueError: time data 'now' does not match format '%Y-%d-%m' (match)
the outputs should match
DatetimeIndex(['2000-01-01 00:00:00+00:00', '2022-12-20 12:04:20.955180+00:00'], dtype='datetime64[ns, UTC]', freq=None)
Replace this line with the output of pd.show_versions()
The text was updated successfully, but these errors were encountered:
this'll be fixed by #50242
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
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
Issue Description
the outputs should match
Expected Behavior
Installed Versions
Replace this line with the output of pd.show_versions()
The text was updated successfully, but these errors were encountered: