在Rnoteb中从python块向R环境传递数据

2024-04-25 12:18:10 发布

您现在位置:Python中文网/ 问答频道 /正文

我在python shelve文件中得到了一些数据,我想把它传递给R进行绘图。我提取它的代码如下所示:

尝试通过单击块中的运行按钮或将光标放在块内并按Ctrl+Shift+Enter来执行此块。在

```{python}
import numpy as np
from numpy import ma, array
import shelve

MODEL = "May2016"
d = shelve.open('fits_shelve_' + MODEL)
hilldata = d['hilldata']
allchi  = d['allchi']
aa      = d['aa'] 
rr      = d['rr'] 
names   = d['names']
weight  = d['weight']
weightc = d['weightc']
dl      = d['dl']
vi      = d['activatorM']
activatorM = d['activatorM']
activatorR = d['activatorR']
d.close()

```

我现在想把这些对象传递给R。有没有办法在Rnotebook中做到这一点?我知道SQL块也可能有类似的情况。在


Tags: 文件importnumpymodelnamesrrshelveaa