A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/pandas-dev/pandas/issues/10154 below:

to_datetime, inconsistent behavior with invalid dates. · Issue #10154 · pandas-dev/pandas · GitHub

Consider Feb 29 1991 (2291991) and March 32 1991 (3321991), Both are invalid dates.

pd.to_datetime(2291991, format="%m%d%Y", coerce=True, exact=True)

Returns a TypeError: ValueError: day is out of range for month

While

pd.to_datetime(3321991, format="%m%d%Y", coerce=True, exact=True)

Returns NaT. Which is what I would expect.

In any case they should return the same error or value

Joris Van den Bossche pointed out on the mailing list:
"It has something to do with the number of the day, only values above 31 convert to NaT, 31 or lower raises the error (eg also 31 April raise error instead of giving NaT)"


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4