【问题标题】:rpy2: handling nested data.tables from Rrpy2:处理来自 R 的嵌套 data.tables
【发布时间】:2019-10-23 21:06:38
【问题描述】:

我有 R 嵌套的 data.table 格式:


Date          Values
2019-10-11    <data.table>
2019-10-12    <data.table>

上述data.table中Values中的每一个&lt;data.table&gt;的格式为:

Item     Inventory   Sales      Revenue
Clothing   100         50       100000
Auto       50          20       5000

所以本质上,对于日期2019-10-11,相应的 data.table 包含销售详细信息。

我希望能够处理此输出并将其保存为独立的 pandas 数据帧。

查看 rpy2 文档 (https://rpy2.readthedocs.io/en/version_2.8.x/introduction.html#importing-packages) ,一种选择似乎是编写一个自定义 R 函数来处理它并在 python 中调用它。但是想知道是否有更简单的方法来获取 R 对象并在 python 中处理它? 谢谢!

【问题讨论】:

    标签: python r rpy2


    【解决方案1】:

    当前 rpy2 版本的文档会回答这个问题吗? https://rpy2.github.io/doc/v3.2.x/html/pandas.html

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-12-18
      • 1970-01-01
      • 1970-01-01
      • 2013-02-09
      • 2020-11-18
      • 1970-01-01
      • 2020-12-22
      相关资源
      最近更新 更多