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. result = myfunc(2)
  12. print(result/2)
  13. print(f'{result:,.2f}')
Success #stdin #stdout 0.43s 65452KB
stdin
Standard input is empty
stdout
1475.0
2,950.00