2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

ipython notebookで.RDataをpandas dataFrameとして読み込む

Posted at
sample.py
import os
import urllib
import pandas
import pandas.rpy.common as com
import rpy2.robjects as robjects

rdata = "http://sample/d.RData"
urllib.urlretrieve(rdata, './d.RData')
robjects.r.load("./d.RData")
loaddata = com.load_data('d')
#os.remove('./d.RData')

print loaddata.head()

      x         y         z

1 0.001000 0.000887 -6.907755
2 0.017306 0.023465 -4.056695
3 0.033612 0.069876 -3.392865
4 0.049918 0.034340 -2.997366
5 0.066224 0.026520 -2.714705

おまじないのような「robjects.r.load」が必須
無いと、com.load_dataで何をしてもnot found しか返ってこなくてハマる。

参考:
http://stackoverflow.com/questions/24220720/pandas-rpy-common-load-data-usage-documentation

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?