title: pandas - how to calculate dot product of two columns, each containing arrays of equal length?
body: <p>assume you have a pandas dataframe as follows:</p>
  
  <pre><code>x = pd.DataFrame(data={
          'x1': [np.array([1,1,1]), np.array([1,2,6])],
          'x2': [np.array([2,3,2]), np.array([3,4,7])] })
  </code></pre>
  
  <p>I'm looking to add a new column to this dataframe, which should contain the dot product of <code>x1</code> and <code>x2</code>, i.e. my output table should look like:</p>
  
  <pre><code>x1      | x2      | result
  [1,1,1] | [1,2,6] | 9 (dot product of [1,1,1] and [1,2,6])
  [2,3,2] | [3,4,7] | 32 (dot product of [2,3,2] and [3,4,7])
  </code></pre>
  
  <p>How can I do this?</p>
  
  <p>I've tried</p>
  
  <pre><code>x.x1.dot(x.x2)
  </code></pre>
  
  <p>however that returns an array <code>[5,11,44]</code>, i.e. looks to calculate the dot product in the "wrong" direction.</p>
  
  <p>Thanks!</p>