You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
exact : bool, default True
Control how format is used:
If :const:True, require an exact format match.
If :const:False, allow the format to match anywhere in the target string.
Based on that, I would expect we don't use anything else in the string that doesn't match the format. But it seems this currently depends on the exact format being used:
but with the changes of #50242, it now actually also does (I suppose because the code path for this specific format was changed, cc @MarcoGorelli)
Another consequence of that the ISO? formats don't actually ignore the remainder of the string, is that it also raises if it is unparseable:
>>> pd.to_datetime(["2011-05-19 AAA"], format="%Y-%m-%d", exact=False)
...
ValueError: time data "2011-05-19 AAA" at position 0 doesn't match format "%Y-%m-%d"
So maybe it is just that the exact=False feature doesn't work / isn't implemented for ISO like formats?
From #50411 (comment)
The documentation of
to_datetime
says:Based on that, I would expect we don't use anything else in the string that doesn't match the format. But it seems this currently depends on the exact format being used:
(happens both on current main and on 1.5)
The text was updated successfully, but these errors were encountered: