title: Appending predicted values and residuals to pandas dataframe
body: <p>It's a useful and common practice to append predicted values and residuals from running a regression onto a dataframe as distinct columns. I'm new to pandas, and I'm having trouble performing this very simple operation. I know I'm missing something obvious. There was <a href="https://stackoverflow.com/questions/22580477/adding-statsmodels-predict-results-to-a-pandas-dataframe">a very similar question</a> asked about a year-and-a-half ago, but it wasn't really answered.</p>
  
  <p>The dataframe currently looks something like this:</p>
  
  <pre><code>y               x1           x2   
  880.37          3.17         23
  716.20          4.76         26
  974.79          4.17         73
  322.80          8.70         72
  1054.25         11.45        16
  </code></pre>
  
  <p>And all I'm wanting is to return a dataframe that has the predicted value and residual from y = x1 + x2 for each observation:</p>
  
  <pre><code>y               x1           x2       y_hat         res
  880.37          3.17         23       840.27        40.10
  716.20          4.76         26       752.60        -36.40
  974.79          4.17         73       877.49        97.30
  322.80          8.70         72       348.50        -25.70
  1054.25         11.45        16       815.15        239.10
  </code></pre>
  
  <p>I've tried resolving this using statsmodels and pandas and haven't been able to solve it. Thanks in advance!</p>