title: Pandas: apply function: TypeError: unsupported operand type(s) for -: 'unicode' and 'unicode'
body: <p>I have the following data frame <code>df</code>:</p>
  
  <pre><code>name    event_time
  ------------------------------------------
  Mary   [(S, 2017-12-03T03:40:20.000Z), (V, 2017-12-07T02:51:32.000Z)]
  Peter  [(S, 2017-11-02T01:11:10.000Z), (V, 2017-11-19T07:23:12.000Z)]
  Andy   [(S, 2017-12-01T10:31:15.000Z), (V, 2017-12-09T12:31:10.000Z)]
  </code></pre>
  
  <p>I then used the following code to find the time duration of the two elements in the <code>event_time</code> field:</p>
  
  <pre><code>df['duration'] = df.event_time.apply(lambda x:x[1][1]-x[0][1])
  </code></pre>
  
  <p>However, I got the following errors:</p>
  
  <pre><code>TypeError unsupported operand type(s) for -: 'unicode' and 'unicode' 
  TypeErrorTraceback (most recent call last)
  &lt;ipython-input-7-7a191c6f2678&gt; in &lt;module&gt;()
  ----&gt; 1 df['duration'] = df.event_time.apply(lambda x:x[1][1]-x[0][1])
  
  /opt/conda/envs/python2/lib/python2.7/site-packages/pandas/core/series.py in apply(self, func, convert_dtype, args, **kwds)
     2218         else:
     2219             values = self.asobject
  -&gt; 2220             mapped = lib.map_infer(values, f, convert=convert_dtype)
     2221 
     2222         if len(mapped) and isinstance(mapped[0], Series):
  
  pandas/src/inference.pyx in pandas.lib.map_infer (pandas/lib.c:62658)()
  
  &lt;ipython-input-7-7a191c6f2678&gt; in &lt;lambda&gt;(x)
  ----&gt; 1 df['duration'] = df.event_time.apply(lambda x:x[1][1]-x[0][1])
  
  TypeError: unsupported operand type(s) for -: 'unicode' and 'unicode'
  </code></pre>
  
  <p>Any idea what I did wrong here? Thanks!</p>