fork download
  1. from scipy import stats
  2.  
  3. x = [2019,2020,2021,2022,2023]
  4. y = [161000,182000,257000,282000,307000]
  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(2024):,}')
Success #stdin #stdout 0.47s 64568KB
stdin
Standard input is empty
stdout
355,400.0