本文介绍了py2:调用函数提示点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过Jupyter Notebook在Pyton中运行R函数.问题是,我的函数名称(来自mouse lib)-包含点.函数的名称是md.pattern,这是我要运行的代码:

I'm tring to run a R function in Pyton via Jupyter Notebook.the problem is, that my function name (from mice lib) - containing dot.the name of the function is md.pattern, and this is the code that I'm tring to run:

from rpy2.robjects.packages import importr
mice = importr('mice')
mice.md.pattern(train)

这是我得到的错误:

AttributeError: module 'mice' has no attribute 'md'

我还尝试运行:

from rpy2.robjects.packages import importr
mice = importr('mice')

pattern = robjects.r("md.pattern")
mice.pattern(train)

并得到相同的错误.

推荐答案

除了注释中建议的答案外,文档还建议以下内容有效:

Beside the suggested answer in the comments, the doc suggests that the following should work:

mice.md_pattern(train)

https://rpy2.github .io/doc/v3.3.x/html/introduction.html#importing-packages

这篇关于py2:调用函数提示点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-11 03:07