I'll be really grate if someone can help me here.
如果有人能在这里帮助我,我真的很感激。
I'm on ubuntu 13.10 with python 2.7, R 3.0.1 and I've followed the rpy2 installation guide with success up to the tests.
我在使用python 2.7,R 3.0.1的ubuntu 13.10上,并且我已经按照rpy2安装指南成功进行了测试。
When running the tests via prompt using this command python -m 'rpy2.tests'
I get the following error:
使用此命令python -m'rpy2.tests'通过提示运行测试时出现以下错误:
rpy2 version: 2.3.8
built against R version: 3-0.1--62743
............................................................................................ ............................................................................................ .........................................................................................................E...........................................................
======================================================================
ERROR: testPandas2ri
(rpy2.robjects.tests.testPandasConversions.PandasConversionsTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/rpy2/robjects/tests/testPandasConversions.py", line 74, in testPandas2ri
pandas_df = robjects.conversion.ri2py(rdataf)
File "/usr/local/lib/python2.7/dist-packages/rpy2/robjects/pandas2ri.py", line 63, in ri2pandas
raise NotImplementedError("Conversion from rpy2 DataFrame to pandas' DataFrame")
NotImplementedError: Conversion from rpy2 DataFrame to pandas' DataFrame
----------------------------------------------------------------------
Ran 349 tests in 4.297s
I get the same error when installing in python interpreter. Where can I find this conversion pakage?
我在python解释器中安装时遇到同样的错误。我在哪里可以找到这个转换包?
1 个解决方案
#1
1
Looks like this code is a bit in flux at the moment. Clearly, there are a number of people (myself included) who use rpy2 and pandas, but rpy2 doesn't yet have a stable built-in converter for this. You could try this module in the current development version of rpy2:
看起来这段代码目前有点不稳定。很明显,有很多人(包括我自己)使用rpy2和pandas,但是rpy2还没有稳定的内置转换器。您可以在rpy2的当前开发版本中尝试此模块:
from rpy2.robjects.pandas2ri import pands2ri
rpy2.robjects.pandas2ri.activate()
It looks like the above code is not yet stable based on comments in the source, so you might be best off writing your own code based off the functions in that module.
根据源代码中的注释,上面的代码看起来还不稳定,所以最好根据该模块中的函数编写自己的代码。
You could also try the code from pandas. See here for documentation of the pandas/rpy2 interface (which has in fact been updated since this documentation was written):
你也可以试试熊猫的代码。请参阅此处以获取pandas / rpy2接口的文档(自编写本文档以来,该接口实际上已更新):
http://pandas.pydata.org/pandas-docs/dev/r_interface.html
http://pandas.pydata.org/pandas-docs/dev/r_interface.html
and the source code:
和源代码:
https://github.com/pydata/pandas/blob/master/pandas/rpy/common.py
https://github.com/pydata/pandas/blob/master/pandas/rpy/common.py
For example:
例如:
import pandas.rpy.common as com
r_dataframe = com.convert_to_r_dataframe(df)
Feel free to ask a question with specific issues you're having if you can't figure it out.
如果您无法弄明白,请随意提出您遇到的具体问题。
#1
1
Looks like this code is a bit in flux at the moment. Clearly, there are a number of people (myself included) who use rpy2 and pandas, but rpy2 doesn't yet have a stable built-in converter for this. You could try this module in the current development version of rpy2:
看起来这段代码目前有点不稳定。很明显,有很多人(包括我自己)使用rpy2和pandas,但是rpy2还没有稳定的内置转换器。您可以在rpy2的当前开发版本中尝试此模块:
from rpy2.robjects.pandas2ri import pands2ri
rpy2.robjects.pandas2ri.activate()
It looks like the above code is not yet stable based on comments in the source, so you might be best off writing your own code based off the functions in that module.
根据源代码中的注释,上面的代码看起来还不稳定,所以最好根据该模块中的函数编写自己的代码。
You could also try the code from pandas. See here for documentation of the pandas/rpy2 interface (which has in fact been updated since this documentation was written):
你也可以试试熊猫的代码。请参阅此处以获取pandas / rpy2接口的文档(自编写本文档以来,该接口实际上已更新):
http://pandas.pydata.org/pandas-docs/dev/r_interface.html
http://pandas.pydata.org/pandas-docs/dev/r_interface.html
and the source code:
和源代码:
https://github.com/pydata/pandas/blob/master/pandas/rpy/common.py
https://github.com/pydata/pandas/blob/master/pandas/rpy/common.py
For example:
例如:
import pandas.rpy.common as com
r_dataframe = com.convert_to_r_dataframe(df)
Feel free to ask a question with specific issues you're having if you can't figure it out.
如果您无法弄明白,请随意提出您遇到的具体问题。