-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: pd.to_datetime doesn't raises AttributeError with specific input… #13909
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
if val.view('i8') == NPY_NAT: | ||
oresult[i] = NaT | ||
else: | ||
oresult[i] = np.nan |
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.
what are you trying to catch 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.
AttributeError: 'float' object has no attribute 'view'
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 don't think the error is intended. can u fix to handle nan
properly?
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.
you need to do a more explict check, something like:
I don't think it can be anything else.
if PyFloat_Check(val): # we *already* know its a null.
oresult[i] = np.nan
else:
orseult[i] = NaT
63cf6e8
to
3597634
Compare
Current coverage is 85.30% (diff: 100%)@@ master #13909 diff @@
==========================================
Files 139 139
Lines 50138 50138
Methods 0 0
Messages 0 0
Branches 0 0
==========================================
Hits 42769 42769
Misses 7369 7369
Partials 0 0
|
@@ -568,6 +568,11 @@ def test_value_counts_datetime_outofbounds(self): | |||
exp = pd.Series([3, 2, 1], index=exp_index) | |||
tm.assert_series_equal(res, exp) | |||
|
|||
res = pd.to_datetime(pd.Series(['2362-01-01', np.nan]), |
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 here
pls add a release note as well |
…s when errors='ignore'(pandas-dev#12424)
3597634
to
58d3d19
Compare
thanks! |
git diff upstream/master | flake8 --diff
…s when errors='ignore'(#12424)