首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >PatsyError:数据参数与列(状态模型)之间的不匹配行数

PatsyError:数据参数与列(状态模型)之间的不匹配行数
EN

Stack Overflow用户
提问于 2019-11-07 00:29:28
回答 1查看 4.9K关注 0票数 4

我正在与使用R风格公式的状态模型与Patsy包一起工作,并收到一个我无法理解的错误,任何提示或技巧都将不胜感激。

PatsyError:数据参数与C(“Industry_Banking&CapitalMarkets”)之间的行数不匹配(8137对1)

DataFrame确实有8137行,没有丢失的数据。

完整代码如下

代码语言:javascript
复制
mixed = smf.mixedlm("""count_SoldServiceName ~ date_int + AzureActiveEngagementCount + AzureEngagementPartnerCount 
                     + DCount_learning_path_name + Industry_Automotive + C('Industry_Banking&CapitalMarkets') + C('Industry_Chemicals&Agrochemicals') + Industry_CivilianGovernment
                     + Industry_ConsumerGoods + C('Industry_Defense&Intelligence') + Industry_DiscreteManufacturing + Industry_Energy + Industry_Gaming 
                     + Industry_HealthPayor + Industry_HealthProvider + Industry_HigherEducation + Industry_Insurance + C('Industry_Media&Entertainment') + Industry_Nonprofit 
                     + Industry_PartnerProfessionalServices + Industry_Pharmaceuticals + C('Industry_Primary&SecondaryEdu/K-12') + Industry_ProfessionalServices 
                     + C('Industry_PublicSafety&Justice') + Industry_Retailers + Industry_SmartSpaces + Industry_Telecommunications +  C('Industry_Travel,Transport&Hospitality') 
                     + Industry_other + InvestmentArea_AA + InvestmentArea_ACO + InvestmentArea_CSE + InvestmentArea_CSM + InvestmentArea_ECIF + InvestmentArea_FT 
                     + InvestmentArea_GBB + InvestmentArea_PAL + active_flag_int + annual_sales_in_us_dollars + commitment_int 
                     + completed_lp_learners + edx_number_completed_courses + employees_total + esi_offer_int
                     +  health_int + s500_int + segmentname_int + fundamentals_flag + role_based_flag"""                    
                     ,workloads_agg
                     ,groups=workloads_agg['tpid_sub']
                     ,exog_re=workloads_agg['date_int']
                     ,missing='drop'
                   ,use_sqrt=True)
mixed_fit = mixed_complete2.fit(method=['bfgs', 'lbfgs', 'cg','powell'])
EN

回答 1

Stack Overflow用户

发布于 2019-11-07 01:11:38

以防其他人碰到这件事。解决方案是重命名所有列,并删除所有特殊字符的实例,如“、”、“/”、“和”等。

票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/58740329

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档