fork(1) download
  1. from scipy import stats
  2.  
  3. x = [1,2,3,4]
  4. y = [1500,3000,4500,5500]
  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(r)
Success #stdin #stdout 0.53s 64996KB
stdin
Standard input is empty
stdout
0.9959100033104785