title: How to subtract a series from a dataframe with matching indexes
body: <p>I have a <code>DataFrame</code> with a number of columns, and a <code>Series</code>. Both have the same <code>DateTimeIndex</code>.</p>
  
  <p>I want to subtract each row's value in the <code>Series</code> from all the values in each row in the <code>DataFrame</code></p>
  
  <p>Here is my sample data:</p>
  
  <pre><code>dates   = pandas.date_range('20180101', periods=10)
  stocks  = ['AAPL', 'GOOG', 'MSFT', 'AMZN', 'FB']
  data    = numpy.random.randn(10,5)
  prices  = pandas.DataFrame(index=dates, columns=stocks, data=data)
  returns = prices.pct_change(1)
  </code></pre>
  
  <p>This gives me a <code>DataFrame</code> similar to the following</p>
  
  <p><a href="https://i.stack.imgur.com/nqYe9.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nqYe9.png" alt="enter image description here"></a></p>
  
  <p>I then create my <code>Series</code>, which is the return of the basket of stocks</p>
  
  <pre><code>basket = returns.mean(axis=1)
  </code></pre>
  
  <p>This gives me a <code>Series</code> similar to the following</p>
  
  <p><a href="https://i.stack.imgur.com/NAZbd.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NAZbd.png" alt="enter image description here"></a></p>
  
  <p>Now I want to subtract the basket returns from each stock's returns:</p>
  
  <pre><code>excess_ret = returns - basket
  </code></pre>
  
  <p>I am getting the following warning:</p>
  
  <blockquote>
  <pre><code>RuntimeWarning: Cannot compare type 'Timestamp' with type 'str', sort order is
  undefined for incomparable objects
    return this.join(other, how=how, return_indexers=return_indexers)
  </code></pre>
  </blockquote>
  
  <p>This is the resulting <code>DataFrame</code>:</p>
  
  <p><a href="https://i.stack.imgur.com/uLTv4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/uLTv4.png" alt="enter image description here"></a></p>
  
  <p>This <em>used</em> to work in <code>pandas-0.16.2</code>, but I am now using <code>pandas-0.22.0</code>, and it seems I am unable to subtract a <code>Series</code> from a <code>DataFrame</code> with matching <code>Indexes</code> now?</p>
  
  <p><strong>Questions:</strong></p>
  
  <ul>
  <li>What is happening in this subtraction operation I am currently performing?</li>
  <li>How can I subtract  each row's value in the <code>Series</code> from all the values in each row in the <code>DataFrame</code>?</li>
  </ul>