title: How to handle NaT values for datetime when doing iterations in python?
body: <p>I am using below code to convert datetime values to integers. It works great except for NaT values. If I am doing this in an iteration, how can I handle NaT values so that I don't get errors such as 'NaTType does not support timetuple'?</p>
  
  <pre><code>import time
  from datetime import datetime
  t=datetime.now()
  t1=t.timetuple()
  int(time.mktime(t1)/60/60/24)
  </code></pre>
  
  <p>Here is the code to create sample data and what I have tried to iterate so far:</p>
  
  <p>create data:</p>
  
  <pre><code>df = pd.DataFrame(data={'date':['05/16/16',''], 'Indicator':[1,0]})
  df['date']=pd.to_datetime(df['date'])
  </code></pre>
  
  <p>Data:</p>
  
  <pre><code>   Indicator       date
  0          1 2016-05-16
  1          0        NaT
  </code></pre>
  
  <p>Iteration code:</p>
  
  <pre><code>def date2int(df):
      if df.date:
          t=df['date']
          t1=t.timetuple()
          return int(time.mktime(t1))
  df['date2int']=df.apply(date2int,axis=1)
  </code></pre>
  
  <p>Error message:</p>
  
  <p>Traceback (most recent call last):</p>
  
  <p>File "", line 1, in 
      df['date2int']=df.apply(date2int,axis=1)</p>
  
  <p>File "/Users/Chen/anaconda/lib/python2.7/site-packages/pandas/core/frame.py", line 4042, in apply
      return self._apply_standard(f, axis, reduce=reduce)</p>
  
  <p>File "/Users/Chen/anaconda/lib/python2.7/site-packages/pandas/core/frame.py", line 4138, in _apply_standard
      results[i] = func(v)</p>
  
  <p>File "", line 4, in date2int
      t1=t.timetuple()</p>
  
  <p>File "pandas/tslib.pyx", line 723, in pandas.tslib._make_error_func.f (pandas/tslib.c:16109)</p>
  
  <p>ValueError: ('NaTType does not support timetuple', u'occurred at index 1')</p>