title: Pandas: Logical Operations with date
body: <p>I'm new to python (2 weeks experience)</p>
  
  <p><i>Can not give specific informations. Because data and code are on my computer at work.</i></p>
  
  <p>I struggle with date operations in python/pandas and want to use logical operations like:<br>
  if date1 > 2019-7-31 then write 1 in var1<br>
  vice versa write 0</p>
  
  <p>also I want to compare columns:<br>
  if date2 > date1 then write 1 in var2<br>
  vice versa write 0</p>
  
  <h2>Table1</h2>
  
  <pre><code>ID    date1      date2        
  1     2019-10-1  2019-7-2
  2     2019-7-30  2019-10-10
  .
  .
  40000
  </code></pre>
  
  <h2>Table 2</h2>
  
  <pre><code>ID     date1       date2        var1   var2
  1      2019-10-1   2019-7-2      1       0
  2      2019-7-30   2019-10-10    0       1
  .
  .
  40000
  </code></pre>
  
  <p>Experimented with date.time
  Many other suggestions worked with variables only but not with columns.</p>
  
  <pre class="lang-py prettyprint-override"><code>df.loc[df["date2"] &gt; "date1", "date2"] = 1
  </code></pre>
  
  <p>-> It fails because date1 is read as a string</p>
  
  <pre class="lang-py prettyprint-override"><code>df.loc[df["date1"] &gt; 2019-7-3, "date2"] = 1
  df.loc[df["date1"] &gt; date.time[2019-7-3], "date2"] = 1
  
  </code></pre>
  
  <p>-> Can not figure out the right syntax, so that <code>2019-7-31</code> is read as a date and comparable.</p>
  
  <p>Alternatively is there a way in python/pandas to convert a date in to the 1900 date system?
  So <code>2019-7-31 = 43677 = Year1900+Days43677</code>.<br>
  This would solve all problems with date handling. Because you can easily compare numbers.
  Of course I would like to reconvert the 43677 in to an actual date.</p>