-
-
Notifications
You must be signed in to change notification settings - Fork 18.7k
Open
Labels
BugDatetimeDatetime data dtypeDatetime data dtypeError ReportingIncorrect or improved errors from pandasIncorrect or improved errors from pandas
Description
Using the latest pandas main (and also happens on released version 2.1.1):
In [1]: pd.to_datetime(["2012-01-01"] * 49 + ["2012-01-02 09"])
...
ValueError: unconverted data remains when parsing with format "%Y-%m-%d": " 09", at position 49. 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.
In [2]: pd.to_datetime(["2012-01-01"] * 50 + ["2012-01-02 09"])
...
ValueError: unconverted data remains when parsing with format "%Y-%m-%d": " 09", at position 1. You might want to try:
...
In the first case, it correctly says "position 49", while in the second case (n > 50), it confusingly says "position 1".
Metadata
Metadata
Assignees
Labels
BugDatetimeDatetime data dtypeDatetime data dtypeError ReportingIncorrect or improved errors from pandasIncorrect or improved errors from pandas