fork download
  1. from scipy import stats
  2.  
  3. x = [5,7,8,7,2,17,2,9]
  4. y = [99,86,87,88,111,86,103,87]
  5.  
  6. slope,intercept,r,p,std_err = stats.linregress(x,y)
  7.  
  8. def myfunc(x):
  9. return slope * x + intercept
  10.  
  11. print(myfunc(10))
Success #stdin #stdout 0.52s 65048KB
stdin
Standard input is empty
stdout
89.02517702596381