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(f'{myfunc(20):,.2f}')
Success #stdin #stdout 0.54s 65224KB
stdin
Standard input is empty
stdout
27,250.00