-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Fix and tests for issue #10154 inconsistent behavior with invalid dates #10520
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
Changes from 4 commits
9d77ffe
2e3d153
62ca4f2
f63933c
8470666
1ab0934
9baa882
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ | |
import pandas.tslib as tslib | ||
import pandas.core.common as com | ||
from pandas.compat import StringIO, callable | ||
from pandas.tslib import NaT, iNaT | ||
import pandas.compat as compat | ||
|
||
try: | ||
|
@@ -320,7 +321,7 @@ def _convert_listlike(arg, box, format): | |
except ValueError: | ||
# Only raise this error if the user provided the | ||
# datetime format, and not when it was inferred | ||
if not infer_datetime_format: | ||
if not infer_datetime_format and not coerce: | ||
raise | ||
|
||
if result is None and (format is None or infer_datetime_format): | ||
|
@@ -349,7 +350,11 @@ def _convert_listlike(arg, box, format): | |
elif com.is_list_like(arg): | ||
return _convert_listlike(arg, box, format) | ||
|
||
return _convert_listlike(np.array([ arg ]), box, format)[0] | ||
try: | ||
return _convert_listlike(np.array([ arg ]), box, format)[0] | ||
except ValueError as e: | ||
if not coerce: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what case does this catch here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This test would not pass There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this should be caught in the cython code. . There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Without the try/except this is the error.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. coerce is already passed to the cython functions my point is that this should be cause and coerced at a lower level There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you are catching an incorrect exception (something else is wrong) - it's not an expected exception There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I reversed this, the tests will not pass now. I don't know how to fix it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. well I'll have a look tomorrow |
||
raise e | ||
|
||
class DateParseError(ValueError): | ||
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.
add the issue number as a comment
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.
pls add a blank line in between functions
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.
Added comments and blank lines. Should I open new issues for these test cases that do not pass?