Python ValueError:endog已计算为具有多个具有形状(50,11)的列的数组

Python ValueError:endog已计算为具有多个具有形状(50,11)的列的数组,python,pandas,dataframe,Python,Pandas,Dataframe,我有一个数据框,看起来像: 并使用panda生成: import matplotlib.pyplot as plt import numpy as np import pandas as pd import statsmodels.api as sm from statsmodels.formula.api import ols df = pd.read_excel("C:\\Users\\amlut\\Desktop\\Classes\\Case Studies\\SureFac

我有一个数据框,看起来像:

并使用panda生成:

import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import statsmodels.api as sm
from statsmodels.formula.api import ols

df = pd.read_excel("C:\\Users\\amlut\\Desktop\\Classes\\Case Studies\\SureFactor_Demand.xlsx")
df = df.dropna()
df.columns = ["Week", "DemandB15", "Demand C17", "Demand D20", "Demand D25", "Demand E26", "Demand F35"]
df.iloc[1,0] = 1
df = df.iloc[1:51]
df.index = range(0,50)
试图在此数据框上运行ols时,会产生错误:

ValueError: endog has evaluated to an array with multiple columns that has shape (50, 11). This occurs when the variable converted to endog is non-numeric (e.g., bool or str).

在我的数据框中似乎没有任何非数字,所以我对这个错误感到非常困惑。我对python或panda几乎没有经验,因此请假设我对noob非常了解。

在调用
read\u excel
时,您可以尝试使用dtype选项吗
dtype={'DemandB15':'int32','DemandC17':'int32',…}
我得到了相同的值错误,并且数据中没有任何非数字列。