从Rpy2到pandas和back

时间:2015-10-19 08:10:18

标签: python r pandas rpy2

我在rpy2中有一个daframe输出以下类:

In [58]: [tuple(x.rclass) for x in df_rpy2]
Out[58]: [('integer',), ('integer',), ('numeric',), ('numeric',)]

现在,如果我这样做:

from rpy2.robjects import pandas2ri as pd2ri

tmp = pd2ri.ri2py(df_rpy2)
df_from_pd = pd2ri.py2ri(tmp)
print([tuple(x.rclass) for x in df_from_pd])

我得到[('array',), ('array',), ('array',), ('array',)]

如何才能拥有初始课程?

0 个答案:

没有答案