Code Sample, a copy-pastable example if possible
df = pd.DataFrame(data = X)
r_dataframe = pandas2ri.py2ri(df)
MASS=importr('MASS')
result = MASS.mca(r_dataframe, nf = 2, abbrev = False)
print(type(result))
Problem description
feeding df from pandas:
script returns:
but with warnings for every column:
UserWarning: Error while trying to convert the column "189". Fall back to string conversion. The error is: Conversion 'py2ri' not defined for objects of type '
Expected Output
I worry about the warnings and can't understand why the data frame is converted to a series of series, how to stop it or solve it.
Output of pd.show_versions()
[paste the output of pd.show_versions()
here below this line]
INSTALLED VERSIONS
commit: None python: 3.6.1.final.0 python-bits: 64 OS: Darwin OS-release: 16.7.0 machine: x86_64 processor: i386 byteorder: little LC_ALL: None LANG: en_GB.UTF-8 LOCALE: en_GB.UTF-8
pandas: 0.20.3 pytest: 3.2.2 pip: 9.0.1 setuptools: 36.5.0 Cython: 0.27 numpy: 1.13.1 scipy: 0.19.1 xarray: None IPython: 6.2.0 sphinx: 1.6.4 patsy: 0.4.1 dateutil: 2.6.1 pytz: 2017.2 blosc: None bottleneck: 1.2.1 tables: 3.4.2 numexpr: 2.6.4 feather: None matplotlib: 2.0.2 openpyxl: 2.4.8 xlrd: 1.1.0 xlwt: 1.3.0 xlsxwriter: 1.0.0 lxml: 4.0.0 bs4: 4.6.0 html5lib: 1.0b10 sqlalchemy: 1.1.14 pymysql: None psycopg2: None jinja2: 2.9.6 s3fs: None pandas_gbq: None pandas_datareader: None
Comment From: TomAugspurger
This looks like an issue for rpy2. It handles all the conversion between pandas and R. You may try opening up an issue on their tracker. I'd recommend making it reproducible by defining what X
is.
Comment From: hewgreen
Thanks. Sorry I posted in the wrong place. I've been looking everywhere for solutions. Thanks for the tip about defining X.
Regards
Matt
On 29 Sep 2017, at 15:45, Tom Augspurger [Masked] wrote:
Preview: This looks like an issue for rpy2. It handles all the convers This email is forwarded from a MASKED EMAIL you created using Blur. IF THIS IS SPAM, CLICK HERE TO BLOCK.
Want to shop safely and privately online? Get Blur Premium.
This looks like an issue for rpy2. It handles all the conversion between pandas and R. You may try opening up an issue on their tracker. I'd recommend making it reproducible by defining what X is.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.