R と組み合わせて pandas を使用したいので、次のようにしました。
import pandas as pd
import rpy2.robjects as robjects
>>> df = pd.DataFrame({'A': [1, 2, 3], 'B': [4, 5, 6]},index=["one", "two"])
>>> robjects.r.cor(df.A, df.B)
ValueError: Nothing can be done for the type <class 'pandas.core.series.Series'> at the moment.
これは、pandas のオブジェクトを rpy2 でまだ使用できないということですか?
次に試しました:
import pandas.rpy.common as com
df = pd.DataFrame({'A': [1, 2, 3], 'B': [4, 5, 6]},index=["one", "two"])
rdf = com.convert_to_r_dataframe(df)
しかし、どうすれば上記を行うことができrdf
ますか? たとえばrdf['A']
、TypeError