У меня есть файл RDA, который я создал в R. Я хочу прочитать этот файл на Python как фрейм данных pandas. У меня есть следующий код, чтобы сделать то же самое:
R object with classes: ('data.frame',) mapped to:
[Float..., Float..., Float..., ..., Float..., Float..., Float...]
area:
R object with classes: ('numeric',) mapped to:
[NA_real_, NA_real_, NA_real_, ..., NA_real_, NA_real_, NA_real_]
i:
R object with classes: ('numeric',) mapped to:
[NA_real_, NA_real_, NA_real_, ..., NA_real_, NA_real_, NA_real_]
s:
R object with classes: ('numeric',) mapped to:
[NA_real_, NA_real_, NA_real_, ..., NA_real_, NA_real_, NA_real_]
...
upslope_area:
R object with classes: ('numeric',) mapped to:
[NA_real_, NA_real_, NA_real_, ..., 292.256494, NA_real_, NA_real_]
i:
R object with classes: ('numeric',) mapped to:
[331347.500000, 331352.500000, 331357.500000, ..., 332187.500000, 332192.500000, 332197.500000]
s:
R object with classes: ('numeric',) mapped to:
[4554812.500000, 4554812.500000, 4554812.500000, ..., 4553982.500000, 4553982.500000, 4553982.500000]
У меня есть файл RDA, который я создал в R. Я хочу прочитать этот файл на Python как фрейм данных pandas. У меня есть следующий код, чтобы сделать то же самое:
[code]import rpy2.robjects as robjects import numpy as np from rpy2.robjects import pandas2ri pandas2ri.activate()
# load your file robjects.r['load']('Data.RDa')
matrix = robjects.r['data']
matrix [/code]
Я получаю следующие результаты:
[code]R object with classes: ('data.frame',) mapped to:
[Float..., Float..., Float..., ..., Float..., Float..., Float...] area: R object with classes: ('numeric',) mapped to:
[NA_real_, NA_real_, NA_real_, ..., NA_real_, NA_real_, NA_real_] i: R object with classes: ('numeric',) mapped to:
[NA_real_, NA_real_, NA_real_, ..., NA_real_, NA_real_, NA_real_] s: R object with classes: ('numeric',) mapped to:
[NA_real_, NA_real_, NA_real_, ..., NA_real_, NA_real_, NA_real_] ... upslope_area: R object with classes: ('numeric',) mapped to:
[NA_real_, NA_real_, NA_real_, ..., 292.256494, NA_real_, NA_real_] i: R object with classes: ('numeric',) mapped to:
[331347.500000, 331352.500000, 331357.500000, ..., 332187.500000, 332192.500000, 332197.500000] s: R object with classes: ('numeric',) mapped to: