title: python excel linear fit
body: <p>I have a weird case regarding Python and Excel linear curve fitting. </p>
  
  <p>Here is Excel
  <a href="https://i.stack.imgur.com/BzUIZ.png" rel="nofollow noreferrer">excel graph</a></p>
  
  <p>And here Python </p>
  
  <p><a href="https://i.stack.imgur.com/paRqC.png" rel="nofollow noreferrer">python graph</a></p>
  
  <p>What I did was simple add a linear trendline in Excel and find the function and R-squared value. I tried the same in Python by numpy polyfit and Statsmodel. The polyfit gave the plot similar to Excel whereas Statsmodel did not. The statsmodel graph was pretty irrelevant. However, the linear fit values and R-squared from Statsmodel were exactly same with Excel. </p>
  
  <p>So, the question is how come Statsmodel yield out the right values but not graph?</p>