The traceback tells you what's wrong
raise ValueError("endog and exog matrices are different sizes")
ValueError: endog and exog matrices are different sizes
Your x has 10 values, your y has 9 values. A regression only works if both have the same number of observations.
endog is y and exog is x, those are the names used in statsmodels for the independent and the explanatory variables.
If you replace your y
by
y = np.arange(1, 11)
then everything works as expected.