-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
add try / except to address issue #10154 to_datetime, Inconsistent be… #10216
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
…havior with invalid dates.
needs tests |
@@ -737,6 +737,13 @@ def test_get_period_field_raises_on_out_of_range(self): | |||
def test_get_period_field_array_raises_on_out_of_range(self): | |||
self.assertRaises(ValueError, period.get_period_field_arr, -1, np.empty(1), 0) | |||
|
|||
class TestDaysInMonth(tm.TestCase): | |||
def test_day_not_in_month_coerce_true(self): |
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 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.
I thought I did, not sure what went wrong.
self.assertTrue(isnull(to_datetime('2015-02-32', format="%Y-%m-%d", coerce=True))) | ||
self.assertTrue(isnull(to_datetime('2015-04-31', format="%Y-%m-%d", coerce=True))) | ||
def test_day_not_in_month_coerce_false(self): | ||
self.assertRaises(ValueError, to_datetime, '2015-02-29', format="%Y-%m-%d", coerce=False) |
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.
yeh, test both errors='ignore'
and errors='raise'
here
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 looks correct
In [10]: pd.to_datetime('2015-02-29', errors='ignore', coerce=False)
Out[10]: '2015-02-29'
I would expect the same from this but get a ValueError.
In [12]: pd.to_datetime('2015-02-29', errors='ignore', format="%Y-%m-%d", coerce=False)
....
ValueError: day is out of range for month
adding format="%Y-%m-%d" should not change the output.
Is this correct and also needs to be fixed?
can you rebase |
On Fri, Jun 26, 2015 at 5:39 PM, jreback [email protected] wrote:
I will work on that this weekend. |
update pymysql to 0.6.3 to avoid cursor bugs Add documentation and tests for SQLAlchemy connectables explicit reference to connection/engine in docs Temporary table test pass compile the connectable
Updated the docstring to make clear that a HDFStore is required for a buffer, if a path is not directly passed
support both sqlalchemy engines and connections
Updated to_hdf doc string
TST: DataFrame.quantile should have Float64Index
…havior with invalid dates.
closes #10154 to_datetime, Inconsistent behavior with invalid dates.
results are now