-
-
Notifications
You must be signed in to change notification settings - Fork 19.4k
Closed
Labels
BugDatetimeDatetime data dtypeDatetime data dtypeError ReportingIncorrect or improved errors from pandasIncorrect or improved errors from pandasMissing-datanp.nan, pd.NaT, pd.NA, dropna, isnull, interpolatenp.nan, pd.NaT, pd.NA, dropna, isnull, interpolate
Milestone
Description
If we treat NaT as a datetime, we would expect pd.NaT == "foo" to return False, != to return True, and for the inequalities to raise:
>>> np.datetime64("NaT", "ns") < "foo"
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: '<' not supported between instances of 'numpy.ndarray' and 'str'
>>> np.nan < "foo"
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: '<' not supported between instances of 'float' and 'str'
>>> pd.NaT < "foo"
False
It isn't obvious to me that the existing behavior is intentional. If we change this to raise, we can simplify NaT.__richcmp__ a bit.
Metadata
Metadata
Assignees
Labels
BugDatetimeDatetime data dtypeDatetime data dtypeError ReportingIncorrect or improved errors from pandasIncorrect or improved errors from pandasMissing-datanp.nan, pd.NaT, pd.NA, dropna, isnull, interpolatenp.nan, pd.NaT, pd.NA, dropna, isnull, interpolate