You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importpandasaspdimportnumpyasnpdf=pd.DataFrame({
'td': [
pd.Timedelta(days=1),
pd.Timedelta(days=3),
np.nan,
],
})
# Comparison of NaN evaluates to Truedf>pd.Timedelta(days=2)
# Comparison of NaN evaluates to Falsedf['td'] >pd.Timedelta(days=2)
Problem description
Comparing a dataframe of Timedeltas to a single Timedelta returns True where the dataframe contains NaN values, but if the same comparison is done for an individual column, it returns False.
Expected Output
It seems that returning False is more consistent with other data types.
Output of pd.show_versions()
INSTALLED VERSIONS
commit: None
python: 3.6.6.final.0
python-bits: 64
OS: Windows
OS-release: 10
machine: AMD64
processor: Intel64 Family 6 Model 45 Stepping 7, GenuineIntel
byteorder: little
LC_ALL: None
LANG: None
LOCALE: None.None
Code Sample, a copy-pastable example if possible
Problem description
Comparing a dataframe of Timedeltas to a single Timedelta returns True where the dataframe contains NaN values, but if the same comparison is done for an individual column, it returns False.
Expected Output
It seems that returning False is more consistent with other data types.
Output of
pd.show_versions()
INSTALLED VERSIONS
commit: None
python: 3.6.6.final.0
python-bits: 64
OS: Windows
OS-release: 10
machine: AMD64
processor: Intel64 Family 6 Model 45 Stepping 7, GenuineIntel
byteorder: little
LC_ALL: None
LANG: None
LOCALE: None.None
pandas: 0.23.4
pytest: None
pip: 18.1
setuptools: 40.6.3
Cython: None
numpy: 1.15.4
scipy: 1.1.0
pyarrow: None
xarray: None
IPython: 7.2.0
sphinx: None
patsy: None
dateutil: 2.7.5
pytz: 2018.7
blosc: None
bottleneck: None
tables: None
numexpr: None
feather: None
matplotlib: None
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: None
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: 2.10
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None
The text was updated successfully, but these errors were encountered: