且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用statsmodel从Python中的GLM中提取系数

更新时间:2023-12-02 13:51:46

model.params是pandas.Series.仅当条目名称是有效的python名称时,才可以作为属性访问.

model.params is is a pandas.Series. Accessing as attribute is only possible if the name of the entry is a valid python name.

在这种情况下,您需要用引号将该名称索引,即model.params["C[T.foo]"]

In this case you need to index with the name in quotes, i.e. model.params["C[T.foo]"]

请参阅 http://pandas.pydata.org/pandas-docs/dev/indexing.html