-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: fixed OutOfBoundsDatetime exception when errors=coerce #45319 #47794
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does this not swallow the errors when errors!="corece"?
This function that this change is in doesn't care about the error variable, shown by the fact that there is no argument for the errors in the code. This function will always return NaT, and the raise and coerce cases are dealt with later in the program. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would need tests
"series_length", | ||
[40, start_caching_at, (start_caching_at + 1), (start_caching_at + 5)], | ||
) | ||
def test_to_datetime_cache_coerce_50_lines(series_length): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def test_to_datetime_cache_coerce_50_lines(series_length): | |
def test_to_datetime_cache_coerce_50_lines_outofbounds(series_length): |
Also could you test the ignore
and raise
options as well?
pandas/core/tools/datetimes.py
Outdated
try: | ||
cache_array = Series(cache_dates, index=unique_dates) | ||
except OutOfBoundsDatetime: | ||
pass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it make sense just to return cache_array
here since the cache_array
cannot be used due to the out of bounds date?
Thanks @srotondo |
…v#45319 (pandas-dev#47794) * BUG: fixed OutOfBoundsDatetime exception when errors=coerce pandas-dev#45319 * BUG: Added test and release note pandas-dev#45319 * BUG: Restructured test parameters pandas-dev#45319 * BUG: Restructured test pandas-dev#45319 * BUG: Restructured parameters for test pandas-dev#45319 * BUG: Renamed test and added raise and ignore cases pandas-dev#45319 * BUG: Changed exception case pandas-dev#45319 Co-authored-by: Steven Rotondo <[email protected]>
…v#45319 (pandas-dev#47794) * BUG: fixed OutOfBoundsDatetime exception when errors=coerce pandas-dev#45319 * BUG: Added test and release note pandas-dev#45319 * BUG: Restructured test parameters pandas-dev#45319 * BUG: Restructured test pandas-dev#45319 * BUG: Restructured parameters for test pandas-dev#45319 * BUG: Renamed test and added raise and ignore cases pandas-dev#45319 * BUG: Changed exception case pandas-dev#45319 Co-authored-by: Steven Rotondo <[email protected]>
doc/source/whatsnew/vX.X.X.rst
file if fixing a bug or adding a new feature.