<h4 dir="auto">Code Sample, a copy-pastable example</h4>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="# Your code here
df = pd.DataFrame([[pd.Timestamp(2017,12,17), pd.Timestamp(2017,12,18)], [pd.Timestamp(2017,12,31), pd.NaT]])

In [7]: df
Out[7]:
           0          1
0 2017-12-17 2017-12-18
1 2017-12-31        NaT

In [8]: df &lt; pd.Timestamp(2017,1,1)
Out[8]:
       0      1
0  False  False
1  False   True

In [9]: df[1] &lt; pd.Timestamp(2017,1,1)
Out[9]:
0    False
1    False
"><pre class="notranslate"><span class="pl-c"># Your code here</span>
<span class="pl-s1">df</span> <span class="pl-c1">=</span> <span class="pl-s1">pd</span>.<span class="pl-v">DataFrame</span>([[<span class="pl-s1">pd</span>.<span class="pl-v">Timestamp</span>(<span class="pl-c1">2017</span>,<span class="pl-c1">12</span>,<span class="pl-c1">17</span>), <span class="pl-s1">pd</span>.<span class="pl-v">Timestamp</span>(<span class="pl-c1">2017</span>,<span class="pl-c1">12</span>,<span class="pl-c1">18</span>)], [<span class="pl-s1">pd</span>.<span class="pl-v">Timestamp</span>(<span class="pl-c1">2017</span>,<span class="pl-c1">12</span>,<span class="pl-c1">31</span>), <span class="pl-s1">pd</span>.<span class="pl-v">NaT</span>]])

<span class="pl-v">In</span> [<span class="pl-c1">7</span>]: <span class="pl-s1">df</span>
<span class="pl-v">Out</span>[<span class="pl-c1">7</span>]:
           <span class="pl-c1">0</span>          <span class="pl-c1">1</span>
<span class="pl-c1">0</span> <span class="pl-c1">2017</span><span class="pl-c1">-</span><span class="pl-c1">12</span><span class="pl-c1">-</span><span class="pl-c1">17</span> <span class="pl-c1">2017</span><span class="pl-c1">-</span><span class="pl-c1">12</span><span class="pl-c1">-</span><span class="pl-c1">18</span>
<span class="pl-c1">1</span> <span class="pl-c1">2017</span><span class="pl-c1">-</span><span class="pl-c1">12</span><span class="pl-c1">-</span><span class="pl-c1">31</span>        <span class="pl-v">NaT</span>

<span class="pl-v">In</span> [<span class="pl-c1">8</span>]: <span class="pl-s1">df</span> <span class="pl-c1">&lt;</span> <span class="pl-s1">pd</span>.<span class="pl-v">Timestamp</span>(<span class="pl-c1">2017</span>,<span class="pl-c1">1</span>,<span class="pl-c1">1</span>)
<span class="pl-v">Out</span>[<span class="pl-c1">8</span>]:
       <span class="pl-c1">0</span>      <span class="pl-c1">1</span>
<span class="pl-c1">0</span>  <span class="pl-v">False</span>  <span class="pl-c1">False</span>
<span class="pl-c1">1</span>  <span class="pl-v">False</span>   <span class="pl-c1">True</span>

<span class="pl-v">In</span> [<span class="pl-c1">9</span>]: <span class="pl-s1">df</span>[<span class="pl-c1">1</span>] <span class="pl-c1">&lt;</span> <span class="pl-s1">pd</span>.<span class="pl-v">Timestamp</span>(<span class="pl-c1">2017</span>,<span class="pl-c1">1</span>,<span class="pl-c1">1</span>)
<span class="pl-v">Out</span>[<span class="pl-c1">9</span>]:
<span class="pl-c1">0</span>    <span class="pl-c1">False</span>
<span class="pl-c1">1</span>    <span class="pl-c1">False</span></pre></div>
<h4 dir="auto">Problem description</h4>
<p dir="auto">When comparing a dataframe of dtype Timestamp to a scalar value (Timestamp or datetime), the result to NaT is always True no matter what operator is used(==, &lt;, &gt;, ...).</p>
<p dir="auto">But it is not the case when compares a series of Timestamps.</p>
<h4 dir="auto">Expected Output</h4>
<h4 dir="auto">Output of <code class="notranslate">pd.show_versions()</code></h4>
<details>
INSTALLED VERSIONS
------------------
commit: None
python: 3.6.2.final.0
python-bits: 64
OS: Windows
OS-release: 10
machine: AMD64
processor: Intel64 Family 6 Model 70 Stepping 1, GenuineIntel
byteorder: little
LC_ALL: None
LANG: None
LOCALE: None.None
<p dir="auto">pandas: 0.21.1<br>
pytest: 3.0.5<br>
pip: 9.0.1<br>
setuptools: 27.2.0<br>
Cython: 0.25.2<br>
numpy: 1.13.3<br>
scipy: 0.18.1<br>
pyarrow: None<br>
xarray: 0.9.6<br>
IPython: 6.1.0<br>
sphinx: 1.5.1<br>
patsy: 0.4.1<br>
dateutil: 2.6.1<br>
pytz: 2017.3<br>
blosc: None<br>
bottleneck: 1.2.0<br>
tables: 3.4.2<br>
numexpr: 2.6.1<br>
feather: None<br>
matplotlib: 2.1.0<br>
openpyxl: 2.4.1<br>
xlrd: 1.0.0<br>
xlwt: 1.2.0<br>
xlsxwriter: 0.9.6<br>
lxml: 3.7.2<br>
bs4: 4.5.3<br>
html5lib: None<br>
sqlalchemy: 1.1.5<br>
pymysql: None<br>
psycopg2: None<br>
jinja2: 2.9.4<br>
s3fs: None<br>
fastparquet: None<br>
pandas_gbq: None<br>
pandas_datareader: 0.5.0</p>
</details>
<h4 dir="auto">Code Sample, a copy-pastable example if possible</h4>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="&gt;&gt;&gt; import pandas as pd
&gt;&gt;&gt; nat = pd.NaT
&gt;&gt;&gt; x = pd.Series([nat])
&gt;&gt;&gt; x.eq(nat)
0    False
dtype: bool
&gt;&gt;&gt; x == nat
0    False
dtype: bool
&gt;&gt;&gt; y = pd.DataFrame(dict(x=x))
&gt;&gt;&gt; y.eq(nat)
       x
0    NaT
&gt;&gt;&gt; y == nat
       x
0    True"><pre class="notranslate"><span class="pl-c1">&gt;&gt;</span><span class="pl-c1">&gt;</span> <span class="pl-k">import</span> <span class="pl-s1">pandas</span> <span class="pl-k">as</span> <span class="pl-s1">pd</span>
<span class="pl-c1">&gt;&gt;</span><span class="pl-c1">&gt;</span> <span class="pl-s1">nat</span> <span class="pl-c1">=</span> <span class="pl-s1">pd</span>.<span class="pl-v">NaT</span>
<span class="pl-c1">&gt;&gt;</span><span class="pl-c1">&gt;</span> <span class="pl-s1">x</span> <span class="pl-c1">=</span> <span class="pl-s1">pd</span>.<span class="pl-v">Series</span>([<span class="pl-s1">nat</span>])
<span class="pl-c1">&gt;&gt;</span><span class="pl-c1">&gt;</span> <span class="pl-s1">x</span>.<span class="pl-en">eq</span>(<span class="pl-s1">nat</span>)
<span class="pl-c1">0</span>    <span class="pl-c1">False</span>
<span class="pl-s1">dtype</span>: <span class="pl-s1">bool</span>
<span class="pl-c1">&gt;&gt;</span><span class="pl-c1">&gt;</span> <span class="pl-s1">x</span> <span class="pl-c1">==</span> <span class="pl-s1">nat</span>
<span class="pl-c1">0</span>    <span class="pl-c1">False</span>
<span class="pl-s1">dtype</span>: <span class="pl-s1">bool</span>
<span class="pl-c1">&gt;&gt;</span><span class="pl-c1">&gt;</span> <span class="pl-s1">y</span> <span class="pl-c1">=</span> <span class="pl-s1">pd</span>.<span class="pl-v">DataFrame</span>(<span class="pl-en">dict</span>(<span class="pl-s1">x</span><span class="pl-c1">=</span><span class="pl-s1">x</span>))
<span class="pl-c1">&gt;&gt;</span><span class="pl-c1">&gt;</span> <span class="pl-s1">y</span>.<span class="pl-en">eq</span>(<span class="pl-s1">nat</span>)
       <span class="pl-s1">x</span>
<span class="pl-c1">0</span>    <span class="pl-v">NaT</span>
<span class="pl-c1">&gt;&gt;</span><span class="pl-c1">&gt;</span> <span class="pl-s1">y</span> <span class="pl-c1">==</span> <span class="pl-s1">nat</span>
       <span class="pl-s1">x</span>
<span class="pl-c1">0</span>    <span class="pl-c1">True</span></pre></div>
<h4 dir="auto">Problem description</h4>
<p dir="auto">Comparisons in a dataframe containing a single nat give incorrect answers. Note this occurs with both datetime and timedelta nats.</p>
<h4 dir="auto">Expected Output</h4>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="0    False
dtype: bool

0    False
dtype: bool

       x
0  False

       x
0  False"><pre class="notranslate"><span class="pl-c1">0</span>    <span class="pl-c1">False</span>
<span class="pl-s1">dtype</span>: <span class="pl-s1">bool</span>

<span class="pl-c1">0</span>    <span class="pl-c1">False</span>
<span class="pl-s1">dtype</span>: <span class="pl-s1">bool</span>

       <span class="pl-s1">x</span>
<span class="pl-c1">0</span>  <span class="pl-c1">False</span>

       <span class="pl-s1">x</span>
<span class="pl-c1">0</span>  <span class="pl-c1">False</span></pre></div>
<h4 dir="auto">Output of <code class="notranslate">pd.show_versions()</code></h4>
<details>
<h2 dir="auto">INSTALLED VERSIONS</h2>
<p dir="auto">commit: None<br>
python: 3.5.2.final.0<br>
python-bits: 64<br>
OS: Linux<br>
OS-release: 4.9.8-100.fc24.x86_64<br>
machine: x86_64<br>
processor: x86_64<br>
byteorder: little<br>
LC_ALL: C<br>
LANG: C<br>
LOCALE: None.None</p>
<p dir="auto">pandas: 0.19.0+579.g4ce9c0c<br>
pytest: 3.0.5<br>
pip: 9.0.1<br>
setuptools: 27.2.0<br>
Cython: 0.25.2<br>
numpy: 1.11.3<br>
scipy: 0.18.1<br>
xarray: 0.9.1<br>
IPython: 4.2.0<br>
sphinx: 1.5.1<br>
patsy: 0.4.1<br>
dateutil: 2.6.0<br>
pytz: 2016.10<br>
blosc: None<br>
bottleneck: 1.2.0<br>
tables: 3.3.0<br>
numexpr: 2.6.2<br>
feather: None<br>
matplotlib: 2.0.0<br>
openpyxl: 2.4.1<br>
xlrd: 1.0.0<br>
xlwt: 1.2.0<br>
xlsxwriter: 0.9.6<br>
lxml: 3.7.2<br>
bs4: 4.5.3<br>
html5lib: 0.999<br>
sqlalchemy: 1.1.5<br>
pymysql: None<br>
psycopg2: None<br>
jinja2: 2.9.4<br>
s3fs: None<br>
pandas_gbq: None<br>
pandas_datareader: None</p>
</details>