title: Using polyfit on pandas dataframe and then adding the results to new columns
body: <p>I have a dataframe like this. For each Id, I have (x1,x2), (y1,y2). I want to supply these to polyfit(), get the slope and the x-intercept and add them as new columns. </p>
  
  <pre><code>    Id        x         y
      1     0.79978   0.018255
      1     1.19983   0.020963
      2     2.39998   0.029006
      2     2.79995   0.033004
      3     1.79965   0.021489
      3     2.19969   0.024194
      4     1.19981   0.019338
      4     1.59981   0.022200
      5     1.79971   0.025629
      5     2.19974   0.028681
  </code></pre>
  
  <p>I really need help with grouping the correct rows and supplying them to polyfit. I have been struggling with this. Any help would be most welcome.</p>