'Error evaluating factor: NameError: name 'Income' is not defined Consumption ~ Income
Recently, I'm learning to calculate regression in python. However, something goes wrong.
Here's the Data
df=pd.read_excel('jaggia_ba_1e_ch06_Data_Files.xlsx',sheet_name = 'Consumption')
df.head(5)
And I want to know the regression " Consumption =β0 + Income*β1 + e "
regression = smf.ols(formula = 'Consumption ~ Income', data = df).fit()
regression.summary2()
However,it show "Error evaluating factor: NameError: name 'Income' is not defined Consumption ~ Income"
I supposed that I use special character and try Q("Income") instead of Income ,but it still didn't work.
What's wrong with it?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|

