title: date calculation (TypeError: unsupported operand type(s) for -: 'str' and 'str')
body: <p>I have a data set as below:</p>
  
  <pre><code>        date_time       srch_co     srch_ci
  0   2014-11-03 16:02:28 2014-12-19  2014-12-15
  1   2013-03-13 19:25:01 2013-03-14  2013-03-13
  2   2014-10-13 13:20:25 2015-04-10  2015-04-03
  3   2013-11-05 10:40:34 2013-11-08  2013-11-07
  4   2014-06-10 13:34:56 2014-08-08  2014-08-03
  5   2014-12-16 14:34:39 2014-12-17  2014-12-16
  </code></pre>
  
  <p>And this is the information of the dataset:</p>
  
  <pre><code>     &lt;class 'pandas.core.frame.DataFrame'&gt;
  RangeIndex: 100000 entries, 0 to 99999
  Data columns (total 3 columns):
  date_time    100000 non-null datetime64[ns]
  srch_co      99878 non-null object
  srch_ci      99878 non-null object
  dtypes: datetime64[ns](1), object(2)
  memory usage: 2.3+ MB
  </code></pre>
  
  <p>What I would like to do is create 2 new columns using the following function:</p>
  
  <pre><code>def duration(row):
      delta = (row['srch_co'] - row['srch_ci'])/np.timedelta64(1, 'D')
      if delta &lt;= 0:
          return np.nan
      else:
          return delta
  
  sample['duration'] = sample.apply(duration, axis=1)
  
  
  def days_in_advance(row):
      delta = (row['srch_ci'] - row['date_time'])/np.timedelta64(1, 'D')
      if delta &lt; 0:
          return np.nan
      else:
          return delta
  
  sample['days_in_advance'] = sample.apply(days_in_advance, axis=1)
  </code></pre>
  
  <p>However, it seems like the date calculation I want to run constantly hits errors. I've searched and found several solutions and tried, but either they would create error or turn the date into inaccurate value. </p>
  
  <p>The methods I've tried to use are such as:</p>
  
  <pre><code>#1)
  def to_integer(dt_time):
      return 10000*dt_time.year + 100*dt_time.month + dt_time.day
  
  #2)
  datetime.strptime(str(row[2]), '%Y%m%d%H%M%S')
  
  #3)    
  pd.to_numeric(sample['date_time'], errors='coerce')
  
  #4)
  sample['srch_ci_int'] = sample['srch_ci'].astype(str).astype(int)
  </code></pre>
  
  <p>I just want to create new column that would calculate the difference of each columns:</p>
  
  <pre><code>sample["duration"] = sample["srch_co"] - sample["srch_ci"]
  sample["days_in_advance"] = sample["srch_co"] - sample["date_time"]
  </code></pre>
  
  <p>Any tips appreciated.</p>