I'm trying to run a Poisson model, like this:
poisson_model_xg = smf.glm(formula="xG ~ home + team + opponent", data=xg_model_data,
family=sm.families.Poisson()).fit()
I'm getting the following error:
ValueError: endog has evaluated to an array with multiple columns that has shape (760, 9). This occurs when the variable converted to endog is non-numeric (e.g., bool or str).
But I can't figure out what does it mean, since all my dataframe is numeric:
xg_model_data.apply(lambda s: pd.to_numeric(s, errors='coerce').notnull().all())
Out[10]:
goals True
xG True
team True
opponent True
home True
dtype: bool
df['col_name'] = pd.to_numeric(df['col_name'])
– Histo