I would like to read a Rdata file in python and, more important be able to manage it adding date and index.
According to the "R" the file is like
[1] 51.42683 55.16056 51.55766 56.49496 60.35126 60.00867 59.86904 60.33833 60.14559 64.40926 71.08281
[12] 73.65758 69.71637 76.85003 67.86899 72.48499 78.47557 94.64443 89.55312 81.55625 90.06554 65.46467
[23] 84.79299 86.40392 90.09126 94.63728 81.17445 69.41700 71.15074 70.79933 79.15242 65.02803 58.99836
[34] 56.32638 50.73658 48.88498 54.27198 53.77287 55.77409 59.09940 55.26362 60.29990 51.63972 51.89953
I also apply the summary tool in R and I have:
summary(file)
Min. 1st Qu. Median Mean 3rd Qu. Max.
32.33 45.94 51.60 54.03 60.92 108.03
As a consequence I have no head or index column.
I would like to import it in Python. Consequently, I have applied both pyreadr and rpy2 but in both cases, despite I can read the file, I am not able to transform it in a pandas frame. Applying for example pyreader as:
import pyreadr
result = pyreadr.read_r('AdapArimaX_AheadDummy_Hour_1.RData')
print(result.keys())
df1 = result["df1"]
I get with result.keys:
odict_keys(['file'])
and an error with the second command.
I think because I have no heads in the original files. What could be the problem on the packages or in the original file?
Thanks
this is the solution that I have found: