fork(1) download
  1. from scipy import stats
  2.  
  3. y = [1,3,5,7,12,17,27,40,55,70,85,117,116,]
  4. x = [2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020,2021]
  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.51s 64908KB
stdin
Standard input is empty
stdout
0.9505587294867015