-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
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
BUG: date comparison fails when series is all pd.NaT values #61188
Comments
Thanks for the report! It looks like in this case |
take |
Hi @rhshadrach , Could you please take a look at my latest commit? I’d appreciate your feedback to ensure everything looks good. Thanks! |
@Mohit-Kundu - are you referring to #61200? I'd suggest reopening that PR if so. Otherwise, can you point me to the PR you're referring to. |
@rhshadrach yes, that's the one! I just reopened it and updated the branch before running the tests. |
Pandas version checks
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
I have confirmed this bug exists on the main branch of pandas.
Reproducible Example
Issue Description
When comparing a
datetime[ns]
or similar series, where all the values turn out to bepd.NaT
values, the comparison just breaks. This is problematic, as the input series cannot necessarily be controlled beforehand, and if there's any actual non-NaT value, the comparison works. The Seriesdtype
values are the same in both cases, which would make me expect that the rest of the behaviour is the same too.Expected Behavior
In the above code, I would expect it to return:
Installed Versions
INSTALLED VERSIONS
commit : 0691c5c
python : 3.10.16
python-bits : 64
OS : Darwin
OS-release : 24.3.0
Version : Darwin Kernel Version 24.3.0: Thu Jan 2 20:24:16 PST 2025; root:xnu-11215.81.4~3/RELEASE_ARM64_T6000
machine : arm64
processor : arm
byteorder : little
LC_ALL : None
LANG : en_GB.UTF-8
LOCALE : en_GB.UTF-8
pandas : 2.2.3
numpy : 1.26.4
pytz : 2025.2
dateutil : 2.9.0.post0
pip : None
Cython : None
sphinx : None
IPython : 8.34.0
adbc-driver-postgresql: None
adbc-driver-sqlite : None
bs4 : None
blosc : None
bottleneck : None
dataframe-api-compat : None
fastparquet : None
fsspec : 2025.3.0
html5lib : None
hypothesis : 6.130.4
gcsfs : None
jinja2 : 3.1.6
lxml.etree : None
matplotlib : 3.10.1
numba : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : 0.28.0
psycopg2 : None
pymysql : None
pyarrow : 15.0.2
pyreadstat : None
pytest : 8.3.5
python-calamine : None
pyxlsb : None
s3fs : 2025.3.0
scipy : None
sqlalchemy : 2.0.39
tables : None
tabulate : None
xarray : None
xlrd : None
xlsxwriter : None
zstandard : None
tzdata : 2025.2
qtpy : None
pyqt5 : None
The text was updated successfully, but these errors were encountered: