-
Notifications
You must be signed in to change notification settings - Fork 28
Description
Hello! rPython-win seems to have a lof of potential and it is really fast! However, I have run into a few issues that I figured I'd tell you about. I was able to get rPython working (somewhat) with the minianaconda3 interpreter by modifying the configure.win as follows:
#!/bin/sh
echo 'PKG_LIBS=-LC:/Users/Mark/Miniconda3/libs -lpython36' > src/makevars.win
echo 'PKG_CFLAGS=-I"C:/Users/Mark/Miniconda3/include"' >> src/makevars.win
I also have Python 2.7 installed, so I had to make this change. I know that 3.6 was working being I called a script with rPython in R and that script references libraries that I did not have installed in 2.7, and the script ran (no errors about the packages not found). However, it seems only simply variables are being returned in Python. I cannot get ndarrays or pandas data frames returned. For example, I wrote created the following script ("C:/Users/Mark/PycharmProjects/untitled4/PandasTest.py"), but noticed that rPython doesn't work quite right (although it does partially work) for the reasons explained below:
import pandas as pd
import numpy as np
x1=3333333
data = np.array([['','Col1','Col2'],
['Row1',1,2],
['Row2',3,4]])
x2=pd.DataFrame(data=data[1:,1:],
index=data[1:,0],
columns=data[0,1:])
x3="dfaafa"
x4=["a", "b", "c"]
I call this from R (see below for the specific R details), on Windows 10 Pro, Build 15063.296, using the following script:
python.load("C:/Users/Mark/PycharmProjects/untitled4/PandasTest.py")
python.get("x1")
[1] 3333333
python.get("x2")
[1] 3333333
python.get("x3")
[1] "dfaafa"
python.get("data")
[1] "dfaafa"
x4=["a", "b", "c"]
You'll notice that rPython seems to return the simple variable types from Python, but it does not seem to be able to transfer back the very important Python dataframe (x2) or the array (data). It's even worse that it returns the wrong values for x2 and data (the last correctly returned value it seems).
Any ideas on how to fix this? I would love to use this package, but have to resort to PythonInR for now, which is slow and awkward to use.
platform x86_64-w64-mingw32
arch x86_64
os mingw32
system x86_64, mingw32
status
major 3
minor 4.0
year 2017
month 04
day 21
svn rev 72570
language R
version.string R version 3.4.0 (2017-04-21)
nickname You Stupid Darkness