-
-
Notifications
You must be signed in to change notification settings - Fork 18.2k
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
Unexpected exception on column with NaT #17559
Comments
duplicate of #15697 in generaly comparing directly against a NaN value will fail intuition, if you want to compare use |
This issue should definitely be reopened: it is not a duplicate of the issue referenced above, which is about the NaT/NaN semantics. Instead, as described in the original post above, I am talking about the exception being raised when the code should instead just run. |
This is indeed not a duplicate, as far as I can see. |
So the fact that seems to make the difference is that here you are comparing to a Series, and not a scalar (the scalar case works 'fine', except from the behavioural bug from #15697 that it should be False instead of True):
|
This now works. Most likely closed by #22163. |
We should still add a test for it? |
Yes. |
Looks like the following test was added in /pandas/tests/arithmetic/test_datetime64.py, as part of GH22163. Would it cover this issue sufficiently already, or should anything else be tested?
|
Code Sample
Problem description & expected output.
In the above code, the final test raises an exception with the datetime example, but works with the two numeric examples.
I would expect the NaT case to behave like the numeric example.
Note: a column with datetimes but no
NaT
makesdf != df.iloc[0]
work as expected.Expected Output
I expect the result to be, like for numeric values, a dataframe that answers the question "is the value identical to that in the first row?" (as a dataframe with the same shape).
Output of
pd.show_versions()
The text was updated successfully, but these errors were encountered: