title: How to compare datetime indexes from dataframe in pandas
body: <p>I have 2 dataframes.<br>
  First one  </p>
  
  <pre><code>df1 = pd.read_csv('t1.txt',delimiter="\t", parse_dates = True, index_col = 'Date')
  
  Date  4001  4002  4003  4004  4005                                                                 
  2017-01-01  151902  2755  0  0  0
  2017-01-02  157271  143598  2343  0  0
  2017-01-03  95806  138308  126034  2034  0
  2017-01-04  68874  91469  129751  116066  1822
  </code></pre>
  
  <p>And the second  </p>
  
  <pre><code>df2 = pd.read_excel('gg.xlsx', parse_dates = True, index_col='Date')  
  Date  num  value
  2017-01-01  4001  68
  2017-01-02  4002  621
  2017-01-03  4003  8
  2017-01-04  4004  5
  2017-01-05  4005  5
  </code></pre>
  
  <p>Here will be some meta-code style:<br>
  As you can see, <code>df1.columns</code> and <code>df2['num']</code> are the same entity.
  <code>df1</code> has mistakes and i want to fix data. I need set <code>df1.values</code> to 0 if <code>df1.Date</code> less than <code>df2.Date</code> for the relative <code>df1.column = df2.num (for 4001, 4002, etc)</code> </p>
  
  <pre><code>for a in df1.columns:
      for b in df1.index:
         if (b &lt; inst.loc[inst['cohort_number']==int(a)].index):
            nw1.at[b,a] = 0
  </code></pre>
  
  <p>How to compare indexes (datetime type) from dataframes?</p>