ValueError: NaN, inf or invalid value detected in weights, estimation infeasible.
Traceback:
File "C:\Users\Iphon\AppData\Local\Programs\Python\Python312\Lib\site-packages\streamlit\runtime\scriptrunner\script_runner.py", line 589, in _run_script
exec(code, module.dict)
File "C:\Users\Iphon\Downloads\Football_Prediction-master\Football_Prediction-master\app.py", line 32, in
model = smf.glm(formula=formula, data=df, family=sm.families.Poisson()).fit()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Iphon\AppData\Local\Programs\Python\Python312\Lib\site-packages\statsmodels\genmod\generalized_linear_model.py", line 1192, in fit
return self._fit_irls(start_params=start_params, maxiter=maxiter,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Iphon\AppData\Local\Programs\Python\Python312\Lib\site-packages\statsmodels\genmod\generalized_linear_model.py", line 1330, in _fit_irls
wls_mod = reg_tools._MinimalWLS(wlsendog, wlsexog,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Iphon\AppData\Local\Programs\Python\Python312\Lib\site-packages\statsmodels\regression_tools.py", line 48, in init
raise ValueError(self.msg.format('weights'))
Hi I ran the script but I get this error
ValueError: NaN, inf or invalid value detected in weights, estimation infeasible. Traceback: File "C:\Users\Iphon\AppData\Local\Programs\Python\Python312\Lib\site-packages\streamlit\runtime\scriptrunner\script_runner.py", line 589, in _run_script exec(code, module.dict) File "C:\Users\Iphon\Downloads\Football_Prediction-master\Football_Prediction-master\app.py", line 32, in
model = smf.glm(formula=formula, data=df, family=sm.families.Poisson()).fit()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Iphon\AppData\Local\Programs\Python\Python312\Lib\site-packages\statsmodels\genmod\generalized_linear_model.py", line 1192, in fit
return self._fit_irls(start_params=start_params, maxiter=maxiter,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Iphon\AppData\Local\Programs\Python\Python312\Lib\site-packages\statsmodels\genmod\generalized_linear_model.py", line 1330, in _fit_irls
wls_mod = reg_tools._MinimalWLS(wlsendog, wlsexog,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Iphon\AppData\Local\Programs\Python\Python312\Lib\site-packages\statsmodels\regression_tools.py", line 48, in init
raise ValueError(self.msg.format('weights'))
James