Description
Code Sample, a copy-pastable example if possible
import pandas as pd
import numpy as np
df = pd.DataFrame({
'td': [
pd.Timedelta(days=1),
pd.Timedelta(days=3),
np.nan,
],
})
# Comparison of NaN evaluates to True
df > pd.Timedelta(days=2)
# Comparison of NaN evaluates to False
df['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
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