The pandas.rpy module is deprecated and will be removed in a future version. We refer to external packages like rpy2.
It seems that it is good to use rpy2
.
Enter with pip install rpy2
.
ipython
In [1]: from rpy2.robjects import pandas2ri
#If you do this, rpy2.robjects.vectors.DataFrame to pandas.core.frame.Converts to DataFrame
In [2]: pandas2ri.activate()
In [3]: from rpy2.robjects import r
In [10]: r["iris"].head(10)
Out[10]:
Sepal.Length Sepal.Width Petal.Length Petal.Width Species
1 5.1 3.5 1.4 0.2 setosa
2 4.9 3.0 1.4 0.2 setosa
3 4.7 3.2 1.3 0.2 setosa
4 4.6 3.1 1.5 0.2 setosa
5 5.0 3.6 1.4 0.2 setosa
6 5.4 3.9 1.7 0.4 setosa
7 4.6 3.4 1.4 0.3 setosa
8 5.0 3.4 1.5 0.2 setosa
9 4.4 2.9 1.4 0.2 setosa
10 4.9 3.1 1.5 0.1 setosa
In [11]: type(r["iris"])
Out[11]: pandas.core.frame.DataFrame
In [12]: type(r["Titanic"])
Out[12]: numpy.ndarray
http://pandas.pydata.org/pandas-docs/stable/r_interface.html#updating-your-code-to-use-rpy2-functions
Installing should be as easy* as
pip install rpy2
(*: except on Windows)
It seems that there is a way to use PypeR because it is ruthless and ruthless, but I feel that it has stopped in 2012, but is it okay?
Recommended Posts