BUG: comparison of pandas NaT with datetime.date evaluating to True · Issue #39151 · pandas-dev/pandas (original) (raw)
Code Sample, a copy-pastable example
import pandas import datetime pandas.NaT < datetime.datetime.now().date()
Problem description
I understood the convention is for NA-types to evaluate to False in all inequalities. The above code evaluates to True.
These DO evaluate to False, as expected.pandas.NaT < datetime.datetime.now()
pandas.NaT > datetime.datetime.now().date()
This seems to have been introduced with 1.2.0, and to not have been the behaviour under 1.1.5.
Output of pd.show_versions()
commit : 3e89b4c4b1580aa890023fc550774e63d499da25
python : 3.7.9.final.0
python-bits : 64
OS : Windows
OS-release : 10
Version : 10.0.18362
machine : AMD64
processor : Intel64 Family 6 Model 158 Stepping 9, GenuineIntel
byteorder : little
LC_ALL : None
LANG : None
LOCALE : None.None
pandas : 1.2.0
numpy : 1.19.2
pytz : 2020.5
dateutil : 2.8.1
pip : 20.3.3
setuptools : 51.1.2.post20210112
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : 1.3.7
lxml.etree : 4.6.2
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 2.11.2
IPython : 7.19.0
pandas_datareader: None
bs4 : None
bottleneck : 1.3.2
fsspec : None
fastparquet : None
gcsfs : None
matplotlib : 3.3.2
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pyxlsb : None
s3fs : None
scipy : 1.5.2
sqlalchemy : 1.3.22
tables : None
tabulate : None
xarray : None
xlrd : None
xlwt : None
numba : 0.52.0