我将数据作为python中的x和y变量存储为列表.如何将其导入python以运行statsmodels.
from __future__ import print_function
import statsmodels.api as sm
import statsmodels.formula.api as smf
import pandas as pd
x = [1,1,2,3]
y=[1,0,0,0]
data = pd.DataFrame(x,y) #to merge the two side by side
star98 = sm.datasets.star98.load_pandas().data
formula = 'x ~ y'
pd.options.mode.chained_assignment = None # default='warn'
mod1 = smf.glm(formula=formula, data=data, family=sm.families.Binomial()).fit()
x = mod1.summary()
Run Code Online (Sandbox Code Playgroud)
ValueError:对deviance函数的第一次猜测返回了nan.这可能是一个边界问题,应该报告