-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: datetime parsing: error message indicating position of conflicting string is wrong for larger data #55345
New issue
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
Comments
starting to brawl with this issue |
I can confirm this occurs on the main development branch: >>> pd.to_datetime(["2012-01-01"] * 50 + ["2012-01-02 09"])
Traceback (most recent call last):
...
ValueError: unconverted data remains when parsing with format "%Y-%m-%d": " 09", at position 1. You might want to try:
...
>>> pd.to_datetime(["2012-01-01"] * 49 + ["2012-01-02 09"])
Traceback (most recent call last):
...
ValueError: unconverted data remains when parsing with format "%Y-%m-%d": " 09", at position 49. You might want to try:
...
`` |
Might be clashing with some other package. Could you share your requirements.txt content files? |
@KartikeyBartwal my guess is that you are using an older version of pandas (starting with pandas 2.0, the datetime parsing got stricter, and we now parse all values using the same format by default, see https://pandas.pydata.org/pdeps/0004-consistent-to-datetime-parsing.html) |
take |
You got it right! My version was '1.3.4' |
Using the latest pandas main (and also happens on released version 2.1.1):
In the first case, it correctly says "position 49", while in the second case (n > 50), it confusingly says "position 1".
The text was updated successfully, but these errors were encountered: