首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >函数在PyCharm而不是JuPyter笔记本中抛出TypeError

函数在PyCharm而不是JuPyter笔记本中抛出TypeError
EN

Stack Overflow用户
提问于 2019-06-26 23:58:44
回答 1查看 979关注 0票数 0

我正在尝试创建一个函数,该函数使用mlxtend中的Apriori算法挖掘和导出项目类别之间的关联规则。而这在jupyter笔记本上工作得很好。当我将相同的函数复制到我的pycharm项目中时,我得到了一个类型错误。

在这两种情况下,我都使用了mlxtend 0.15.0.0。

代码语言:javascript
复制
def apriori():



    inputPath = inputPathField.get()
    data = pd.read_csv(inputPath, usecols=['BillId', 'Level5'])



    data['dummy'] = 1



    matrix = data.pivot_table(values='dummy', index='BillId', columns='Level5').fillna(0)



    frequent_itemsets = apriori(matrix, min_support=0.0005, use_colnames=True)



    rules = association_rules(frequent_itemsets, metric="lift", min_threshold=1)



    export = rules[(rules.antecedents.str.len() <= 3)]



    export = export[(export.consequents.str.len() == 1)]


    export = export[(export.confidence >= 0.15)]


    outputPath = outputPathField.get()
    export.to_csv(outputPath)
代码语言:javascript
复制
File "/home/scrybe/PycharmProjects/tkinter/Apriori.py", line 37, in apriori
frequent_itemsets = apriori(matrix, min_support=0.0005, use_colnames=True)
TypeError: apriori() got an unexpected keyword argument 'min_support'
EN

回答 1

Stack Overflow用户

发布于 2019-06-27 13:03:54

问题是我使用的函数名已经是mlxtend中的函数名了。一旦我改变了它,问题就解决了。感谢@vishal。

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

https://stackoverflow.com/questions/56776880

复制
相关文章

相似问题

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